0

I have the following XML document structure . I need to load it into a TreeView in WinForms and be able to get the attributes of a particular node once selected with the mouse.

<?xml version = "1.0" encoding = "UTF-8" ?>
<siteMap>
    <Niveau_1 att1 = "att1" att2 = "att2" att3="att3" >
        <Niveau_2  att1 = "att1" att2 = "att2" att3="att3" >
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
        </Niveau_2>
        <Niveau_2  att1 = "att1" att2 = "att2" att3="att3" >
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
        </Niveau_2>
    <Niveau_1/>
    <Niveau_1 att1 = "att1" att2 = "att2" att3="att3" >
        <Niveau_2  att1 = "att1" att2 = "att2" att3="att3" >
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
        </Niveau_2>
        <Niveau_2  att1 = "att1" att2 = "att2" att3="att3" >
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
            <Niveau_3  att1 = "att1" att2 = "att2" att3="att3" />
        </Niveau_2>
    <Niveau_1/>
</siteMap>
Deep Blue
  • 39
  • 1
  • 7
  • See http://stackoverflow.com/questions/10329293/creating-custom-treeview-treenode ... perhaps use the NodeId or NodeType ? – Paul Zahra Jul 16 '15 at 09:13
  • @PaulZahra , I searched before asking the question and didn't manage to do it. – Deep Blue Jul 16 '15 at 09:15
  • @KarmaEDV, rain forest ? If you don't know the answer or don't want to answer or don't have manners, just ignore the question and move on with your life, if you have any. :) – Deep Blue Jul 16 '15 at 09:28
  • My preference is to use the recursive solution in following posting : http://stackoverflow.com/questions/28976601/recursion-parsing-xml-file-with-attributes-into-treeview-c-sharp – jdweng Jul 16 '15 at 10:22
  • @DeepBlue the fact that you now added the tag "winforms" Shows that my question was valid. I asked politely with a little ending joke. – KarmaEDV Jul 16 '15 at 10:51
  • Do you need the code to maintain this hierarchy? Nivaeu 1 -> 2 -> 3? How deep will it go? Please tell us more about the structure. Write it down in your question. – oOo Jul 16 '15 at 16:29

0 Answers0