[lxml-dev] complex node

Stefan Behnel stefan_ml at behnel.de
Mon Jul 13 08:16:16 CEST 2009


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

Stefan


More information about the lxml-dev mailing list