Re: Parsing XML to a TreeView



MuZZy wrote:
Hi,

Consider i have an XML file like this:
<node type="item">
    <user>MuZZy</user>
    <password>Password</password>
<node>
<node type="folder">
    <node type="item">
        <user>John</user>
        <url>www.website.com</url>
    </node>
    <node type = "folder">
        <node type = "item">
            <memo>free text</memo>
        </node>
    </node>
</node>


Here each <node> will be a TreeNode and the other tags like <user>, <url>, <password> are some properties stored in the tree node. Nodes can be of two types: "folder" and "item". "folder" can contain "item"'s
There can be unlimited nesting of <node> except that <node type="item"> can't contain any nodes, but <node type = "folder"> can.


So how do i parse it into a treeview? I am using a XmlTextReader nut it reads the whole XML in line, so i can't really determine parent/chaild relations between nodes.

I'm sure there is a standard way of doing that but i can't find one...
Any ideas?

Thank you,
MuZZy


Actually. i got it! I just need to use XMLDocument instead
.