[BangPypers] (no subject)

Dhananjay Nene dhananjay.nene at gmail.com
Tue Sep 24 13:59:14 CEST 2013


On Tue, Sep 24, 2013 at 10:38 AM, bab mis <babmis at outlook.com> wrote:
> Hi ,Any XML parser which gives the same kind of data structure as yaml parser gives in python.  Tried with xmlmindom but ir's not of a proper datastrucure ,every time i need to read by element and create the dict.

Just think about it for a moment. yaml consists of dicts and lists.
xml on the other hand consists of ordered sequences of named nodes
each of which is simultaneously a dict of attributes and a collection
of additional ordered sequences of nodes. Its hard to stuff XML into
native python constructs like dicts and lists. They just don't map
well.

If you could make assumptions about the XML having specific
constraints which would allow it to be cast into dicts and lists, you
could with trivial effort write a transformer to transform a DOM into
a bunch of lists and dicts. In other words - the issue is not the tool
- it is the domain you are dealing with.


More information about the BangPypers mailing list