I have the following non-alterable XML file :
<products>
<product>
<attributes>
<att name="Name" value="TOTO" />
<att name="Surname" value="Toto" />
<att name="Age" value="10" />
</attributes>
</product>
<product>
<attributes>
<att name="Name" value="TATA" />
<att name="Surname" value="Tata" />
<att name="Age" value="20" />
</attributes>
</product>
<product>
<attributes>
<att name="Name" value="TITI" />
<att name="Surname" value="Titi" />
<att name="Age" value="30" />
</attributes>
</product>
</products>
Using C#, I need to extract the value of the value field for the nodes which value is equal to Name and Age, at a given index. Good example : inputing 2 would return a string containing TITI and another string containing 30.
For the moment, I'm using an XmlDocument to load the XML file, and a XmlNodeList with the GetElementsByTagName method to get all the attributes ; then, I can display those elements, but I don't manage to display only two of them, depending of attributes names and an index.
At best, I need a method like myXmlNodeList.Node["att"].Attributes["Name"].AtIndex(x).
Could anyone help me ?