package similar to XML::Simple
Paulo Pinto
paulo.pinto at cern.ch
Fri Jan 30 08:12:13 EST 2004
I mean multiple nested dictionaries with lists.
But handyxml seems to solve my problem.
Thanks, guys
Peter Hansen wrote:
> Paulo Pinto wrote:
>
>>does anyone know of a Python package that
>>is able to load XML like the XML::Simple
>>Perl package does?
>>
>>For those that don't know it, this package
>>maps the XML file to a dictionary.
>
>
> A simple dictionary is insufficient to represent XML in general,
> so perhaps you're talking about a subset of XML, maybe with no
> attributes, and where the order of the child elements doesn't
> matter? Or something else?
>
> Or do you really mean something like a multiply-nested
> dictionary, perhaps with lists as well?
>
>
>>Of course I can build such a package myself
>>but it would be better if it already exists :)
>
>
> We were able to build something similar by stripping down
> Fredrik Lundh's elementtree until we had little more than the
> calls to the expat parser (i.e. we used his source as a tutorial
> on using expat :-), so if this is something like the XML-subset
> I mention above, you could do it in an hour or so from scratch
> if you knew Python well.
>
> -Peter
More information about the Python-list
mailing list