parsing XML

kaklis at gmail.com kaklis at gmail.com
Mon May 17 06:23:03 EDT 2010


On May 16, 10:52 am, Stefan Behnel <stefan... at behnel.de> wrote:
> Jake b, 16.05.2010 09:40:
>
> > Check out Amara:http://www.xml3k.org/Amara/QuickRef
>
> > It looks promising. For a pythonic solution over sax / dom.
>
> > >>> Iter(doc.team.player)
> > # or
> > >>> doc.team.player[0].name
>
> Ah, right, and there's also lxml.objectify:
>
>      from lxml.objectify import parse
>
>      root = parse('teamfile.xml').getroot()
>
>      for player in root.player:
>          print(player.attrib)
>
> Prints an attribute dict for each player.
>
> Stefan

Thank you all so much!!!
And it's not for a homework.
Just trying to find out the style DOM, SAX, ElementTree etc. that fits
better to my kind of thinking.
Antonis



More information about the Python-list mailing list