2011-06-19

Parsing and serializing with SAX

Several years ago, I started working on the XML parser that Gilbert Baumann had written as part of his web browser called "Closure". Since then, "Closure XML" (or cxml for short) has developed into a set of little libraries, one main goal being completeness and correctness with regard to the various standards they are following.

And standards abound in XML land, which is nice for implementors (thanks to the good test suites!) and nice for users (because the specs partially serve as documentation, and make it easy to transition between different languages implementing them). But I've always tried to release cxml with enough documentation to get users started for all the parts that are implementation-specific. And not all areas are covered by standards: Of course, the document format itself is specified strictly; the same goes for XPath, XSLT, schemas, etc.

But little is standardized in terms of API support, and that sort of choice is generally good: After all, a Lisp XML parser should fit into the Lisp world and not mimick (say) JavaScript too much. But many good ideas can be borrowed from other languages. Examples inspired by Java are STP, motivated heavily by XOM (and tweaked for added lispiness) -- and SAX:

SAX is a classic Java API. It defines a protocol of methods that get called by an XML parser, and each method call signifies an event (e.g. that the parser saw a XML tag). In cxml, SAX is one of two fundamental APIs offered (the other being a StAX-like pull-based interface), and it's essential to its inner workings. Yet I had never bothered to document it fully. For one thing, everyone seemed to know SAX from Java anyway. It's also hidden from view for most users. And ultimately, it's just a list of generic functions, right?

Technically it is just that, and yet it's central to communication between cxml's libraries, and it makes parsing and serialization in cxml modular and reusable. Hence some users had long suggested to me that I should explain SAX in full.

So here it is: The SAX overview.

TL;DR: Skip to the link above.

2011-06-18

SBCL on github and gitorious

SBCL moved to git last week, and with the main repository hosted on sf.net, several users have asked for an SBCL mirror on github.

Automatically synced mirrors are available on github and gitorious (where SBCL branches had, of course, also been uploaded by contributors long before the official switch to git), and it will now be easier than ever to make your own repository and branches.

The mirrors update several times a day:

Please test, and good luck with your SBCL hacking efforts!