Confused: looking for a simple XML parser

Kay Schluehr kay.schluehr at gmx.net
Sat Aug 16 08:08:16 EDT 2008


On 16 Aug., 02:21, Rex <rex.eastbou... at gmail.com> wrote:
> Hello,
>
> I am a Python programmer facing my first small XML project. I am
> looking to find a simple tool to take an XSD file and convert the XSD
> tree structure to another text format (e.g. an adjacency matrix for
> the tree's graph), or convert one xml file format definition into
> another, non-xml one. I don't need to validate XML documents created
> by this schema or do anything else fancy. I just need to be able to
> traverse this tree programmatically and find which child attributes
> belong to which parent attributes, etc.
>
> There seem to be so many Python libraries and programs out there that
> I don't know what to use.
>
> What tool should I use?
>
> Thanks,
> Rex

Many people seem to be happy with elementree and it might be the most
adequate parser for your purposes. Personally I'm sticking with expat
and define handlers to build custom data structures. Both expat and
elementree are available in the standard library.

http://docs.python.org/lib/module-xml.parsers.expat.html
http://docs.python.org/lib/module-xml.etree.ElementTree.html



More information about the Python-list mailing list