A reverse-XML parser


LMX is a reverse XML parser. (LMX is XML backwards, get it?) It is event-based, and returns every entity in the XML document in reverse order.

For example, given the XML document:


the events you receive from LMX will be:

  1. End of element: foo
  2. End of element: baz
  3. Characters: Goodbye
  4. Start of element: baz (no attributes)
  5. End of element: bar
  6. Characters: Hello
  7. Start of element: bar (no attributes)
  8. Start of element: foo (no attributes)

The API in the LMX 1.0 series is only available for Obj-C/Cocoa on Mac OS X. It has mostly the same API as NSXMLParser; if you're used to NSXMLParser, LMX should have no learning curve for you (other than the mind-bendingness of events coming in in the reverse order). LMX 2.0 will add a pure C implementation and API, with an Obj-C/Cocoa wrapper, and will be cross-platform.

A test app is included, for timing and testing purposes.

LMX is already in use. It is currently used by Adium, powering its message history. The last n messages from your previous chat with the same person are read from the logs, which are in an XML format, then display. Adium uses LMX so that this process is O(1) (independent of the number of messages in a transcript), rather than O(m) (dependent on the number of messages in a transcript) as it would be with a conventional XML parser.

LMX is provided under a three-clause BSD license.


Objective-C source code and an Xcode 2.4 project
128-bit FNV1 hash: 0903f12435341183a255bf110e632647
MD5 hash: 4c31cad495c54837fae29bc629bb46fe
SHA-1 hash: db375b5696557930d8fd59f3ee668e429dfe1432
Detached PGP (GPG) signature of LMX-1.0.tbz using public key ID C6550423.
128-bit FNV1 hash: f6d794a887922ea92e72313ed9582dc5
MD5 hash: 2224b3b082df99283114950a98614c4d
SHA-1 hash: 2df6c07db9313da07d9c4e7f0e4b5b14f832f4c9

MD5 and SHA1 signatures were created using the md5sum(1) and sha1sum(1) utilities from GNU coreutils.

Subversion repository

If you want to contribute a patch to LMX, the easiest way is to work from the Subversion repository. The URL for LMX's Subversion repository is svn://svn.adiumx.com/liblmx, though I recommend using the 1.0 branch.

Version history

1.0 (r83)

2007-03-03 http://boredzo.org/lmx
Valid XHTML 1.0! Valid CSS!