I want to manipulate XML files.
...
<Document Id="1091">
<Indexes>
<Index Name="MODD" Value="aaa" />
<Index Name="DDAT" Value="bbb" />
<Index Name="CDAT" Value="ccc" />
<Index Name="MDAT" Value="ddd" />
<Index Name="DOCN" Value="eee" />
<Index Name="STAT" Value="fff" />
...
</Indexes>
</Document>
<Document Id="2088">
...
I have retrieve the value of some index randomly. I would avoid the loop on all the indexes. What is the tool you advise me to use and why?
- load the file as a text file and use RegEx
- load the xml file and use XPath
- load the xml file and use Linq to Xml
- generate the classes with xsd.exe or xsd2code
- another approach
I’d go with LinqToXml. Good syntax and easy to use!