Getting all the XML paths from a XML file.
Hello Friends,
I am using the below XML file and trying to get all the distinct files from the XML tree. I want to store the distinct paths in a file.
The duplicate paths are eliminated as shown in the last part of the question.
Please help me get a c# code to do that.
<RootElement>
<FirstChild>
<Leaf1></Leaf1>
<Leaf2></Leaf2>
</FirstChild>
<SecondChild>
<Leaf3></Leaf3>
<Leaf4></Leaf4>
</SecondChild>
<SecondChild>
<Leaf3></Leaf3>
<Leaf5></Leaf5>
</SecondChild>
</RootElement>
******************************************
# of paths in the XML Tree are 10
/RootElement
/RootElement/FirstChild
/RootElement/SecondChild
/RootElement/SecondChild
/RootElement/FirstChild/Leaf1
/RootElement/FirstChild/Leaf2
/RootElement/SecondChild/Leaf3
/RootElement/SecondChild/Leaf4
/RootElement/SecondChild/Leaf3
/RootElement/SecondChild/Leaf5
******************************************
# of distinct paths in the XML Tree are 9
/RootElement
/RootElement/FirstChild
/RootElement/SecondChild
/RootElement/SecondChild
/RootElement/FirstChild/Leaf1
/RootElement/FirstChild/Leaf2
/RootElement/SecondChild/Leaf3
/RootElement/SecondChild/Leaf4
/RootElement/SecondChild/Leaf5
Thanks,
sana.