472,090 Members | 1,319 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,090 software developers and data experts.

Confused: looking for a simple XML parser

Rex
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
Aug 16 '08 #1
2 1181
Hi,

On Fri, 15 Aug 2008 17:21:56 -0700, Rex wrote:
What tool should I use?
For easy stuff ElementTree (bundled with Python 2.5 but also available to
older versions), for more complex stuff lxml (which extends the ET API,
so the learning curve is incremental).

regards,
Marek
Aug 16 '08 #2
On 16 Aug., 02:21, Rex <rex.eastbou...@gmail.comwrote:
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-xm...ers.expat.html
http://docs.python.org/lib/module-xm...ementTree.html
Aug 16 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Kenneth Downs | last post: by
13 posts views Thread by Paulo Pinto | last post: by
8 posts views Thread by Dan | last post: by
4 posts views Thread by Greg B | last post: by
15 posts views Thread by google | last post: by
5 posts views Thread by Just Another Victim of the Ambient Morality | last post: by
4 posts views Thread by =?Utf-8?B?SmFu?= | last post: by
7 posts views Thread by bvdp | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.