Re: automatically building Python data structures from DOM trees?

Uche Ogbuji <[email protected]>
Newsgroups gmane.comp.python.xml
Organization Fourthought, Inc.
Message-ID <1133569444.15399.262.camel@borgia>
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/

_______________________________________________
XML-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/xml-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.