load() – Load xml content from file and convert to python object.

A simple xml parse and build lib.

lazyxml.load(fp, **kw)

Load xml content from file and convert to python object.

>>> import lazyxml
>>> with open('demo.xml', 'rb') as fp:
>>>     lazyxml.load(fp)
>>> from cStringIO import StringIO
>>> buffer = StringIO('<?xml version="1.0" encoding="utf-8"?><demo><foo><![CDATA[<foo>]]></foo><bar><![CDATA[1]]></bar><bar><![CDATA[2]]></bar></demo>')
>>> lazyxml.load(buffer)
{'bar': ['1', '2'], 'foo': '<foo>'}
>>> buffer.close()

Note

kw argument have the same meaning as in loads()

Parameters:fp – a file or file-like object that support .read() to read the xml content
Return type:dict