Link to home
Start Free TrialLog in
Avatar of ol muser
ol muserFlag for United States of America

asked on

sorting XML

Hi,

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>

Open in new window


 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!
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

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.
Avatar of ol muser

ASKER

Thanks @TheLearnedOne, can you show me the code to do that for the above XML?
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial