Question How to read the xml attribute names dynamically from an xml content

passionit

New member
Joined
Jan 17, 2012
Messages
1
Programming Experience
5-10
Hi I want to select the full path of each element tag in the xml content. I am not bothered now about the value in each attribute.

eg. This is the output i need:

root\details\firstname
root\details\lastname
root\details\age
etc

Is there anyway i can do so. Please help.

Thanks in advance...
 
a Linq example:
        Dim paths = From x In XDocument.Load("data.xml").Descendants _
                    Where Not x.HasElements _
                    Select String.Join("/", (From y In x.AncestorsAndSelf Select y.Name.LocalName).Reverse.ToArray)
 
Back
Top