[lxml-dev] atom model
Ian Bicking
ianb at colorstudy.com
Thu Jun 7 05:45:24 CEST 2007
After writing a object model for Atom that serialized to and parsed from
XML, I realized Atom and its XML representation really shouldn't be
separated, so I created some custom elements to make it a bit easier to
handle, while still using the XML as the sole source of information.
I'm a little unsure what to do about the namespaces. Everything is in a
namespace, but it's tedious to put in everywhere. I've put in some
little helper methods internally, and mostly you don't need to use the
namespace globally, but I'm unsure about it all. I've created an
Element() function that automatically adds the namespace if no namespace
is given; helps a little I guess.
The standard ways of creating elements is a bit tedious, really. I
guess builder can help there a bit, though I don't see a way to give my
own parser (which I need in this case). Any suggestions about any of it
are welcome.
The module is at:
https://svn.openplans.org/svn/TaggerStore/trunk/taggerstore/atom.py
I didn't really look around in the lxml source, but I used several
descriptors that could be general purpose. Maybe there's a better way
to do these, or maybe they could go in lxml somewhere.
--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
| Write code, do good | http://topp.openplans.org/careers
More information about the lxml-dev
mailing list