ol muser
asked on
sorting XML
Hi,
I would like to read the simple XML below.
and be able to find the record and the corresponding name with the max age.
How best can it be done with the minimum lines of code?
thanks!
I would like to read the simple XML below.
<list version="1.0">
<meta>
<type>resource-list</type>
</meta>
<resources start="0" count="4">
<resource classname="Quote">
<field name="name">Vincent</field>
<field name="username">Hill</field>
<field name="age">0.32</field>
<field name="hair">black</field>
</resource>
<resource classname="Quote">
<field name="name">John</field>
<field name="username">Tedelon</field>
<field name="age">27</field>
<field name="hair">brown</field>
</resource>
<resource classname="Quote">
<field name="name">Michael</field>
<field name="username">Lopez</field>
<field name="age">20</field>
<field name="hair">red</field>
</resource>
<resource classname="Quote">
<field name="name">Frank</field>
<field name="username">Lopez</field>
<field name="age">25</field>
<field name="hair">black</field>
</resource>
</resources>
</list>
and be able to find the record and the corresponding name with the max age.
How best can it be done with the minimum lines of code?
thanks!
One possible approach would be load the XML into a System.Data.DataSet, and then use a filter to find the record that you need.
ASKER
Thanks @TheLearnedOne, can you show me the code to do that for the above XML?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.