I have XElement object which is my XML tree read from XML file. Now I want to check all the nodes in this tree to get first attribute name and value. Is there any simple way to go through all of the nodes (from root till leaves)? My XML file has got very many different and strange nodes – that’s why it’s harder to solve this issue. I thought about writing some recursion, but hope it’s another way to solve that easier.
I have XElement object which is my XML tree read from XML file. Now
Share
Maybe take a look to Xpath. an XPath like this
//*[@id=42]could do the job.It means get all nodes which have an attribute “id” of value 42.
You can do just
//*which gonna returns all nodes in a tree.Xpath :
http://msdn.microsoft.com/en-gb/library/ms950786.aspx
Syntax :
http://msdn.microsoft.com/en-us/library/ms256471.aspx