XMLite - a Python module for parsing and printing XML
The xmlite module is an extremely light weight
XML parser and printer. It does not use the DOM or SAX
interfaces but instead works with a simple list or rather nested
lists to represent an XML document. The parser takes as input a
string or filename and returns a list with all the elements of
the XML file.
The first item in the top level XML list is a
dict object with 'version', 'encoding', and 'standalone'
keys. If there are any decl tags such as 'DOCTYPE' they will be
next in the list and will be tuples with the decl tag name and
the value of the tag as the second item of the tuple.
Comments are included as lists of two
items. The first item is None and the second is a string which
is the comment text.
CDATA are tuples of two items. The first item
is 'CDATA' and the second is the CDATA content.
XML elements are lists. The first item in the
list is the element tag or name. The second item is a dict
object with includes all the attributes of the element. Any
remainin list items are either comments, strings, CDATA, or more
elements as lists.