simplexmlapi 0.1 Released
written by Ian McCracken
at Saturday, August 23, 2008
I was writing some Python tools for svn access, and found myself needing to parse the XML that
Besides using dotted-name syntax to walk an XML document, simplexmlapi can map attributes to dotted names, which will let you make an easy API for known XML structures. For instance, you can map the
The project is hosted at http://simplexmlapi.googlecode.com/ It's also available from the Cheese Shop and via
svn log
and svn info
return. Python's XML libraries are pretty annoying to use, to say the least. I wrote up a quick way to walk an XML document using dotted name syntax, and it seemed like it could be generally useful, so I cleaned it up, documented it, and packaged it up for release.Besides using dotted-name syntax to walk an XML document, simplexmlapi can map attributes to dotted names, which will let you make an easy API for known XML structures. For instance, you can map the
svninfo.repository.url
dotted name to the repourl
attribute. Thus, one can simply:
>>> d = simplexmlapi.loads(
... '<xml><doc><item>somevalue</item></doc></xml>',
... map=dict(val="doc.item"))
>>> d.val
u'somevalue'
The project is hosted at http://simplexmlapi.googlecode.com/ It's also available from the Cheese Shop and via
easy_install simplexmlapi
. API docs are hosted at http://packages.python.org/simplexmlapi.