Creating referenceable objects from XML

Laurent Pointal laurent.pointal at limsi.fr
Mon Dec 5 10:42:09 EST 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).
> 
> Thanks in advance!

Another tool (ElementsTree already quoted): Amara
( http://uche.ogbuji.net/uche.ogbuji.net/tech/4suite/amara/ )

[never tested but bookmarked as it seem interresting]

A+

Laurent.



More information about the Python-list mailing list