如何使用XML填充TreeView而不会丢失属性?

时间:2015-07-16 09:06:14

标签: c# xml winforms treeview

我有以下XML文档结构。我需要将它加载到WinForms中的TreeView中,并且能够在用鼠标选择后获取特定节点的属性。

<?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>

0 个答案:

没有答案