module to create python object representation from xml

I'm searching for an easy to handle python native module to create python object representation from xml.

I found several modules via google (one of them is XMLObject) but didn't want to try out all of them.

What do you think is the best way to do such things?

EDIT: I missed to mention that the XML I'd like to read is not generated by me. It's an existing XML file in a structure of which I have no control over.


You say you want an object representation, which I would interpret to mean that nodes become objects, and the attributes and children of the node are represented as attributes of the object (possibly according to some Schema). This is what XMLObject does, I believe.

There are some packages that I know of. 4Suite includes some tools to do this, and I believe Amara specifically implements this (built on top of 4Suite). You can also use lxml.objectify, which was inspired by Amara and gnosis.xml.objectify.

Of course a third option is, given a concrete representation of the XML (using ElementTree or lxml) you can build your own custom model around that. lxml.html is an example of that, extending the base interface of lxml with some HTML-specific functionality.

Need Your Help

Consuming complex JSON API responses into NSObjects using NSKeyValueCoding

iphone ios json nsobject key-value-coding

The blog post SAVING JSON TO CORE DATA has some great tips for converting a JSON response into a Core Data entity. What I want to do is a little bit more specific. I'd like to take a JSON response ...

Get Last Day of the Month in Python

python date

Is there a way using Python's standard library to easily determine (i.e. one function call) the last day of a given month?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.