Jython or Pyton issue-- Kindly Help me....

Venugopal Reddy venugopal.reddy at tspl.com
Mon Oct 13 13:39:33 CEST 2014


Dear All,

How to write a program for reading or parsing the XML file in Sub root Wise.

For ex:

Below XMl, I want to read/ parse first country details and here also two year tag values are there.. Here I need to read/parse first year value only measn '2008' Only..After that I need to read second country details.

Please help me .. i am struggling to get this solution..

<?xml version="1.0"?>
<data>
    <country name="Liechtenstein">
        <rank>1</rank>
        <year>2008</year>
        <year>2009></year>
        <gdppc>141100</gdppc>
        <neighbor name="Austria" direction="E"/>
        <neighbor name="Switzerland" direction="W"/>
    </country>
    <country name="Singapore">
        <rank>4</rank>
        <year>2011</year>
        <gdppc>59900</gdppc>
        <neighbor name="Malaysia" direction="N"/>
    </country>
    <country name="Panama">
        <rank>68</rank>
        <year>2011</year>
        <gdppc>13600</gdppc>
        <neighbor name="Costa Rica" direction="W"/>
        <neighbor name="Colombia" direction="E"/>
    </country>
</data> 



More information about the Python-list mailing list