Reading XML document in treeview (C# winform)
I have the following xml source file:
<?xml version="1.0" encoding="utf-8" ?>
<course id="2555" title="Developing Microsoft .NET Applications for Windows (Visual C#
.NET)" length="5 days" source="http://www.microsoft.com/learning/syllabi/en-
us/2555Afinal.mspx">
<module id="1" title="Introducing Windows Forms" location="D:\Disk-C\Documents
and Settings\orit_itzhar.ATRICA\My Documents\XML\c#">
<lesson id="1.1">
<subject>Creating a Form</subject>
<file>Introducing_Windows_Forms_Course-2555-Module-1.pdf</file>
</lesson>
<lesson id="1.2">
<subject>Adding Controls to a Form</subject>
<file>type&exceptions.pdf</file>
</lesson>
<lesson id="1.3">
<subject>Creating an Inherited Form</subject>
<file>winforms.pdf</file>
</lesson>
<lesson id="1.4">
<subject>Organizing Controls on a Form</subject>
<file>BnsLrnCs.zip</file>
</lesson>
<lesson id="1.5">
<subject>Creating MDI Applications</subject>
<file>Working_with_Controls_Course-2555-Module-2.pdf</file>
</lesson>
<lab id="1.1">
<exercise id="1.1.1">Creating a New Windows Form</exercise>
<exercise id="1.1.2">Inheriting a New Form from an Existing
Windows Form</exercise>
</lab>
</module>
<module id="2" title="Working with Controls" location="D:\Disk-
C\Documents and Settings\orit_itzhar.ATRICA\My Documents\XML\c#">
<lesson id="2.1">
<subject>Creating an Event Handler for a Control</subject>
<file>Introducing_Windows_Forms_Course-2555-Module-1.pdf</file>
</lesson>
<lesson id="2.2">
<subject>Using Windows Forms Controls</subject>
<file>type&exceptions.pdf</file>
</lesson>
<lesson id="2.3">
<subject>Using Dialog Boxes in a Windows Forms
Application</subject>
<file>winforms.pdf</file>
</lesson>
<lesson id="2.4">
<subject>Adding Controls at Run Time</subject>
<file>BnsLrnCs.zip</file>
</lesson>
<lesson id="2.5">
<subject>Creating Menus</subject>
<file>Working_with_Controls_Course-2555-Module-2.pdf</file>
</lesson>
<lesson id="2.6">
<subject>Validating User Input</subject>
<file>Working_with_Controls_Course-2555-Module-2.pdf</file>
</lesson>
<lab id="2.1">
<exercise id="2.1.1">Creating and Using Controls</exercise>
</lab>
</module>
</course>
I want to display in hierarchy similar to the one in the XML file, a table of content
of the course in a treeview in a winform in C# program.
I want that the xpath will take at the top level from the "course" nodes, the "title"
attribute, then from the "module" node, the "title" attribute, and from under the
lessons, the values of the "subject" node for each lesson at the 3rd level.
I expect something that will look like:
Developing Microsoft .NET Applications for Windows (Visual C# .NET)
Introducing Windows Forms
Creating a Form
Adding Controls to a Form
Creating an Inherited Form
etc...
Can someone please assist?
Thanks

