xml2dict


Use attributes of dictionary to access xml elements

See also: http://lxml.de/objectify.html

For latest, please refer to https://github.com/nkchenz/lhammer

Examples

XML2Dict:

fromstring # Parse a given string

parse #Parse a given file

```

from xml2dict import XML2Dict

if name == 'main': s = """ 10 491691test 491692test2 503938hello, world """

xml = XML2Dict()
r = xml.fromstring(s)
from pprint import pprint
pprint(r)
print r.result.count.value
print r.result.count.n

for data in r.result.data:
    print data.id, data.name 
pprint(xml.parse('a'))

```

Project Information

  • License: GNU GPL v2
  • 15 stars
  • svn-based source control

Labels:
xml dict python