[Tutor] xml parsing from xml
Steven D'Aprano
steve at pearwood.info
Thu May 8 02:17:15 CEST 2014
On Wed, May 07, 2014 at 06:43:11PM +0530, jitendra gupta wrote:
> Hi
>
> I just want to create a new xm file from existing xml file. so basically i
> want to put contry details in countryName.xml from these file.
>
> I thought to do via read a line by line with normal file handling. but
> there a problem with that. So i want to handle python XML . Could you
> please suggest on this.
I'm afraid you need to explain in more detail what you want to do. Given
the input quoted below:
> <?xml version="1.0"?><data>
> <country name="Liechtenstein">
> <rank updated="yes">2</rank>
> <year>2008</year>
> <gdppc>141100</gdppc>
> <neighbor name="Austria" direction="E"/>
> <neighbor name="Switzerland" direction="W"/>
> </country>
> <country name="Singapore">
> <rank updated="yes">5</rank>
> <year>2011</year>
> <gdppc>59900</gdppc>
> <neighbor name="Malaysia" direction="N"/>
> </country>
what output are you expecting?
--
Steven
More information about the Tutor
mailing list