Re: automatically building Python data structures from DOM trees?

Luis Miguel Morillas <[email protected]>
Newsgroups gmane.comp.python.xml
Message-ID <[email protected]>
Mensaje citado por Han-Wen Nienhuys <[email protected]>:

> 
> Hi,
> 
> I'm looking for a package that will translate a minidom tree into 
> something which  is native python, i.e. translate
> 
> <bar>
>     <bla>
>        <foo id="1" />
>        <foo id="2" />
>     </bla>
> </bar>
> 
> into a python object, for which the following holds
> 
>     bar.bla[1].id == "2"
> 
> 
> Of course,  I would have to supply a mapping from names like "bar" and 
> "bla" to my own classes (probably deriving from xml.node).
> 
> Does such a thing exist?
> 
> 

Yes, Try Amara (http://uche.ogbuji.net/tech/4suite/amara/)

<monty>
  <python spam="eggs">What do you mean "bleh"</python>
  <python ministry="abuse">But I was looking for argument</python>
</monty>

Becomes a data structure such that you can write:

binding.monty.python.spam

In order to get the value "eggs" or

binding.monty.python[1]


-- 
Luis Miguel
_______________________________________________
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.