[lxml-dev] complex node
Jonas
jonas.esp at googlemail.com
Mon Jul 13 15:46:47 CEST 2009
2009/7/13 Stefan Behnel <stefan_ml at behnel.de>:
>
> Jonas wrote:
>> I'm trying to parsing a xml file (in python) to convert it to
>> dictionaries and then to JSON.
>>
>> This is the file:
>> http://unicode.org/cldr/data/common/main/es.xml
>> and I've got all nodes except dates', which is enought complex.
>>
>> Any idea to get it? because I'm very tired of try it.
>
> What's your question?
>
> - how to find the 'dates' element in a parsed tree?
> - how to traverse the subtree of the 'dates' element?
> - how to extract the data from the parsed tree?
> - how to extract the data using iterparse()?
> - how to map the data to a dictionary?
> - how to map the data to a dictionary while parsing?
> - how to map the data to a recursive structure of dictionaries?
This is my main problem. But
checking i.e. if each element has attributes to manage it
> - how to find a dictionary mapping that works well with JSON?
> - how to find a dictionary mapping that works well in the use case that
> I didn't tell you about?
> - ... something else ?
* For if anybody is interested here there is an awesome conversor from
XML to JSON
http://code.google.com/p/xmltojson/
More information about the lxml-dev
mailing list