Python X-Expression Library

Parse XML into an Xexpr and back.

Download

Documentation

Data

Xexpr
Atom | Element
Atom
String | (singleton String)
Element
(list String Attr (listof Xexpr))
Attr
(dictionaryof String String)

Functions

xexpr.Write

to_xml
Contract
Xexpr -> String
Description
Convert the given Xexpr to the XML string it represents.

xexpr.Read

to_xexpr
Contract
String -> Xexpr
Description
Convert the well-formed XML string to the Xexpr it represents.
Exceptions
Raises xml.parsers.expat.ExpatError when given a non-well-formed XML string.
Keyword Arguments
Name Type Default Description
strip_whitespace Boolean False Whether to strip trailing and leading whitespace from all strings.
Name Type Default Description

Dependencies

Python 2.4 or higher

Thank You

Pete Markowsky provided answers to all my Python questions. Matt Horan made sure I made no stupid last-minute mistakes. The PLT popularized the X-expression.

Contact

Mike Burns mike@mike-burns.com