CL-XML:
Common Lisp support for the 'Extensible Markup Language'

james anderson,


CL-XML is a collection of Common LISP modules for data stream parsing and serialization according to the "Extensible Markup Language" and anscilliary standards. The modules perform parsing and serialization between XML, XML Query, and XML Path expressions and DOM-compatible CLOS instances. The XML processor includes a conformant, validating, namespace-aware model-based parser. It supports, in particular, namespace-aware DTD-based validation. The XPATH module comprises LISP bindings for the XML Path library, an S-expression-based namespace-aware path model, and a macro-based path model compiler which implements an XPATH-algebra. The XQUERY module comprises LISP bindings for the XML Query library, an S-expression-based query model which incorporates the XPATH facilities, and a macro-based query compiler. The base CLOS model implements the XML Query Data Model in a class hierarchy which presents an Infoset compatible programming interface.

A description is available here.

Look here for some hints on how to load cl-xml, work with XML documents, and even implement simple rpc.


Availability

In-Progress

20040101: There has been some progress on method combinationd for clisp, which means thatI'm now a step closer to porting to that implementation. For information on porting to other common-lisp environments here is a list of known issues.

Releases

Source archives are available for the MCL, Lispworks, Allegro, CMUCL, OpenMCL, and Scieneer implementations of Common Lisp. A separate document provides the download paths and details on the implementation status.

BNF

The respective BNF descriptions of the respective XML, XPath, and XQuery syntax used to generate the parsers are available individually. In some cases, they have been normalized and otherwise edited to expedite parsing. I'd be interested to hear if any of the modifications would appear to affect conformance.

An additional BNF is included for HTML. This includes additional productions for unterminated empty tags. (see xml:code;xparser;html-parser.lisp)

Examples

graphs
I was curious about how an automatic layout package would fare with DTD and DOM graphs. A naive generator for GraphViz's "dot" format is a straight-forward graph walk. The results are adequate for smaller examples, but larger instances will need a more refined approach. The larger files failed to load with the current GraphViz 1.7.6 beta for Windows. As I'm rather Linux/C imparied, I was fortunate and grateful, that someone was curious and ran them through the Linux version. Thus the two SVGs below, which I was able to view with Adobe's SVG plugin.

email (from "xml:tests:xml:email.xml") : DOM, DTD
channel (from "xml:tests:xml:channel.xml"): DOM, DTD
REC-xml-20001006.xml: DTD as DOT, as SVG(768K)
REC-xhtml1-20000126.html: DTD as DOT, as SVG(444K)

Anyone curious about DOCBOOK?

xquery / use case NS issues
Use-case NS of WD-xmlquery-use-cases-20010608 reserved the publication of a DTD until schemas were available. It is not clear that this delay is necessary. The documents below were processed, validated, and serialized with 0.908+

AuctionWatchList.xml
AuctionWatchList.dtd
record.dtd
AuctionWatchListOut.xml


© setf.de 2004 [20040106]