parsing XML

Pietro Campesato pietro.campe at gmail.com
Sat May 15 18:56:41 EDT 2010


On May 14, 7:57 am, "kak... at gmail.com" <kak... at gmail.com> wrote:
> Hi to all, let's say we have the following Xml
> <team>
>   <player name='Mick Fowler' age='27' height='1.96m'>
>     <points>17.1</points>
>     <rebounds>6.4</rebounds>
>   </player>
>   <player name='Ivan Ivanovic' age='29' height='2.04m'>
>     <points>15.5</points>
>     <rebounds>7.8</rebounds>
>   </player>
> </team>
>
> How can i get the players name, age and height?
> DOM or SAX and how
>
> Thanks
> Antonis

I've found some code which converts an XML string to a dictionary
here:
http://nonplatonic.com/ben.php?title=python_xml_to_dict_bow_to_my_recursive_g&more=1&c=1&tb=1&pb=1

Once your data is in a dictionary extracting info will be much easier.



More information about the Python-list mailing list