Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
C++ Programming

Read XML

 

Top Ten Programs

Read XML
The file bbc.xml is as shown:
<world>
  <region id='Europe'>
   <country id='de' name='Germany' pop='82000000'/>
   <country id='fr' name='France'  pop='60000000'/>
  </region>
  <region id='Asia'>
    <country id='cn' name='China' pop='1300000000'/>
  </region>
</world>

The XPath expression //country[@id='fr']/@pop find the country node that has attribute id set to 'fr', it returns the value of the pop attribute.

The value returned should be 60 million.