Creating referenceable objects from XML

uche.ogbuji at uche.ogbuji at
Sun Dec 11 21:29:44 CET 2005

Michael Williams wrote:
> Hi All,

> I'm looking for a quality Python XML implementation.  All of the DOM
> and SAX implementations I've come across so far are rather
> convoluted.  Are there any quality implementations that will (after
> parsing the XML) return an object that is accessible by name? Such as
> the following:

> xml = """
> <book>
>    <title>MyBook</title>
>    <author>the author</author>
> </book>
> """

> And after parsing the XML allow me to access it as so:

> book.title

> I need it to somehow convert my XML to intuitively referenceable
> object.  Any ideas?  I could even do it myself if I knew the
> mechanism by which python classes do this (create variables on the fly).

Looks as if MIchael is working with Amara now, but I did want to note
for the record that APIs that allow one to access a node in the
"book.title" fashion are what I call Python data bindings.

Python data bindings I usually point out are:

Amara Bindery:

Based on updates to EaseXML in response to my article another entry
might be:


ElementTree ( ) is a
Python InfoSet rather than a Python data binding.  You access nodes
using generic names related to the node type rather than the node name.
 Whether data bindings or Infosets are your preference is a matter of
taste, but it's a useful distinction to make between the approaches.
It looks as if Gerald Flanagan has constructed a little specialized
binding tool on top of ElementTree, and that's one possible hybrid

xmltramp ( ) is another
interesting hybrid.

Uche Ogbuji                               Fourthought, Inc.                   

More information about the Python-list mailing list