[XML-SIG] automatically building Python data structures from DOMtrees?

Fredrik Lundh fredrik at pythonware.com
Fri Dec 2 13:58:34 CET 2005


Han-Wen Nienhuys wrote:

> 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?

does it has to be a minidom tree?  if not, you can find plenty of alternatives
under the "data bindings" section in this article:

    http://www.xml.com/pub/a/2004/10/13/py-xml.html

</F> 





More information about the XML-SIG mailing list