[XML-SIG] automatically building Python data structures from DOM trees?
Uche Ogbuji
uche.ogbuji at fourthought.com
Sat Dec 3 01:24:04 CET 2005
On Sat, 2005-12-03 at 00:42 +0100, Han-Wen Nienhuys wrote:
> Uche Ogbuji wrote:
> > Thanks, Luis.
> >
> > Yep, and 'bar.bla[1].id == "2"' would work out of the box with Amara.
> >
> > One question, Han-Wen, do you have to use minidom as the source, or can
> > you go from straight XML? Just seems unnecessary to parse to minidom
> > and then bind.
>
> No, but I'd like to have the source as a complete, in-memory tree. I
> thought that DOM was just a word for such a tree. I'm a complete XML
> newbie.
Some people use the term that way. I wouldn't. There's a W3C standard
called DOM, which is a tree. It's also very suboptimal for Python.
Minidom is based on DOM but tries to make some concessions to Python's
simpler world view. Many will tell you it's still way too Java-esque.
There are other tree models for XML that have nothing to do with DOM,
including Amara and ElementTree.
> For the moment, I have concocted something simple with new.classobj() -
> if I need anything more complex, I suppose that I'll have a look at Amara.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/
More information about the XML-SIG
mailing list