HighTechTalks DotNet Forums  

read XML & display in a tree view

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss read XML & display in a tree view in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default read XML & display in a tree view - 12-27-2005 , 03:13 AM






Hi,
I want to read XML file and display the results in a tree view.For
example folder structure.
I use .net 1.1 framework.

Thanks
Nilu


Reply With Quote
  #2  
Old   
pH
 
Posts: n/a

Default Re: read XML & display in a tree view - 12-28-2005 , 08:06 AM






You'll probably get a better response if you post this on one of the
language groups (microsoft.public.dotnet.languages/vb or
microsoft.public.dotnet.languages/csharp).

You could use the System.Xml.XmlReader class, to read through the
elements in the XML file. First, set up a root node on your treeview,
and make a reference to it, called something like TreeCursor. Then
whenever you reach an Element node in the XML, add a new child-element
to your TreeCursor node with the title equal to the XmlReader's name
property. Now, if the XmlNode is a block node (has a closing tag), set
the cursor to point to the tree node you've added, and continue; if
not, just carry on parsing. Then, if you reach an EndElement node in
the XML, you can set TreeCursor to point to its parent, and continue
parsing. At the end of the file, if it's well-formed, TreeCursor should
end up pointing back to the root element.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.