SingleSpeed Biking

Electric Vehicles Electric Vehicles  Spyder
Palm OS Applications Palm
Free Software
 GeekCalc  LDAP Probe
Robot Mill Robot
 who am I
 Email me

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.

Release Notes

  • Version 1.2 (10/5/2003)
    • Fixed bug where empty element is not added to the parent element.
  • Version 1.1 (6/9/2003)
    • Added GPL to file.
  • Version 1.0 (3/3/2003)
    • First release.

Download it here or from SourceForge project page.

The CVS access page on SourceForge for this small project is here. SourceForge,net Logo

Email me at Peter@Ohler.com if you discover any bugs or have any suggestions.