parsing XML
Stefan Behnel
stefan_ml at behnel.de
Sun May 16 03:52:22 EDT 2010
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
More information about the Python-list
mailing list