[Baypiggies] XSLT vs Python for XML manipulation (Venkatraman S)
Ramin Firoozye
raminf at gmail.com
Thu May 29 19:08:51 CEST 2008
> On a related note, am trying to code a generic class(xml parser) which
> defines its own member variables at run time. That is, if the xml is :
> <a>
> <b>10</b>
> <c>30</c>
> <d>
> <e>100</e>
> <f>200</f>
> </d>
> </a>
>
> and after i parse it, i should be able to access individual entities
> with a
> DOT notation, i.e, a.b returns me 10 and a.d returns me a list of
> 100,200.
>
> Am just clueless - any pointers?
> --
> Venka
You can try using Amara (http://uche.ogbuji.net/tech/4suite/amara/).
It supports dot notation to access sub-elements as well as array
notation to index into children. To get the sub-element text as list,
you'll have to write a small bit of custom code that traverses the
children and returns their bodies as a list. Feel free to post back
here if you have trouble with it.
Ramin
More information about the Baypiggies
mailing list