Closure XML

# Closure XML Parser

An XML parser written in Common Lisp.

Closure XML was written by Gilbert Baumann as part of the Closure web browser and is now maintained by David Lichteblau. It is licensed under Lisp-LGPL.

CXML implements a namespace-aware, validating XML 1.0 parser as well as the DOM Level 2 Core interfaces. Two parser interfaces are offered, one SAX-like, the other similar to StAX.

Send bug reports to cxml-devel@common-lisp.net (list information).

### Add-on features

The following libraries are available as separate downloads:

- cxml-rng: Relax NG validation
- cxml-stp: STP, an alternative to DOM
- Plexippus: XPath 1.0
- Xuriella: XSLT 1.0
- Closure HTML: parse HTML 4; convert between HTML and XHTML

### Recent Changes

cxml and closure-common are now available from git instead of CVS. Please refer to the installation instructions for details.

rel-2008-11-30

- Support for user-specified output encodings using Babel.
- More support for input encodings, thanks to Pierre Mai.
- Lisps using full 21 bit code points as characters are now fully supported (including SBCL and Clozure CL) addition to the existing support for 16 bit characters using UTF-16 (including Allegro and LispWorks). The feature rune-is-utf-16 is now set on 16 bit Lisps. Make sure to update and recompile both cxml and closure-common when upgrading.
- New sink slot sink-omit-xml-declaration-p; functions cxml:unescaped and sax:unescaped.
- Added XPath support to the XMLS compatibility model.
- Fixed various DTD serialization bugs. Fixed xmls compatibility bugs. Fixed variable names in with-source. Fixed klacks-error export. Consistently use strings as base URIs. Fixed PARSE for non-file-streams. Added support for the UTF-8 "BOM", thanks to Ivan Shvedunov.

Runes have been moved into a separate project, named closure-common. Releases will be available as separate tarballs in the download directory. Please refer to the installation instructions for details.

rel-2007-10-21

- Moved runes into a separate project.
- Incompatible SAX changes: Added new classes sax:abstract-handler, sax:content-handler, sax:default-handler. Implementations of SAX handlers should now subclass one of these classes.
- fixed make-source :buffering nil, thanks to Magnus Henoch for the report
- fixed time and space usage in cases where entity references follow each other (thanks to Ivan Shvedunov for the report)
- In the DOM builder, grow a buffer for string normalization exponentially, fixing a long-standing speed issue.

rel-2007-08-05

- Various DTD serialization fixes
- UTF-8 fix, thanks to Francis Leboutte

rel-2007-07-07

- Fixed build on non-Unicode lisps. Fixed parsing on non-Unicode lisps. Fixed Unicode detection on OpenMCL.
- New function cxml:parse.
- Serialization no longer defaults to canonical form.
- Fixed octet array argument to make-source.
- XMLS compatibility is not bug-for-bug-compatible with XMLS any more. There is now a mode using pairs of local name and namespace URI, and a second mode using qualified names only. The old behaviour using pairs of prefix and local names was removed. (Thanks to Douglas Crosher.)
- SCL support (thanks to Douglas Crosher). Includes support for implementations where URIs are valid namestrings, and a mode where normal streams are used instead of xstreams and ystreams (albeit both SCL-specific at this point).
- new convenience serialization function cxml:doctype. Various DTD serialization fixes.

rel-2007-05-26

- cxml.asd has been split up into cxml.asd for the XML parser and runes.asd for the runes package, in preparation of a complete split of the two systems. Future CXML releases will use separate tarballs for runes and cxml.
- xml:base support (SAX and Klacks only, not yet used in DOM). See documentation here and here.
- New class broadcast-handler as a generalization of the older sax-proxy.
- New class tapping-source, a klacks source that relays events from an upstream klacks source unchanged, while also emitting them as SAX events to a user-specified handler at the same time.
- Changed attributes to carry an lname even when occurring without a namespace. Added new functions attribute*, unparse-attribute, and macro with-element*, with-namespace* to the SAX generation wrapper API.
- Klacks improvements: Incompatibly changed klacks:find-element and find-event to consider the current event as a result. Added klacks-error, klacks:expect, klacks:skip, klacks:expecting-element. Fixed serialize-event to generate start-prefix-mapping and end-prefix-mapping events. New function map-current-namespace-declarations.
- fixed build with common-lisp-controller

rel-2007-02-18

- New StAX-like parser interface.
- Serialization fixes (thanks to Nathan Bird, Donavon Keithley).
- characters.lisp cleanup (thanks to Nathan Bird).
- Namespace normalizer bugfixes.
- Minor changes: clone-node on document as an extension. DOM class hierarchy reworked. New function parse-empty-document. Fixed the DOM serializer to not throw away local names. Fixed a long-standing bug in the parser for documents without a doctype. ANSI conformance fixes.

rel-2006-01-05

- Implemented DOM 2 Core.
- Error handling overhaul.
- UTF-8 string support in DOM on Lisps without Unicode characters.
- Sink API has been changed.
- Support internal subset serialization.
- Whitespace normalizer.
- Gilbert Baumann has clarified the license as Lisp-LGPL.
- Use trivial-gray-streams.

rel-2005-06-25

- Port to OpenMCL (thanks to Rudi Schlatte).
- Port to LispWorks (thanks to Edi Weitz).
- Minor new features: include-default-values argument to make-xmls-builder; handler argument to parse-dtd-stream; SAX proxy class
- Various bugfixes.

patch-357 (2004-10-10)

- Auto-detect unicode support for better asdf-installability.
- Use the puri library for Sys-ID handling.
- Semi-automatic caching of DTD instances.
- Support user-defined entity resolvers.
- Support for Oasis XML Catalogs.
- xhtmlgen version of Franz htmlgen.
- Fixes for SBCL's unicode support.

patch-306 (2004-09-03)

- Event-based serialization which does not require DOM documents
- XMLS compatiblity
- minor bugfixes (thread safety; should work on clisp again)

patch-279 (2004-05-11)

- Validation
- bugfixes; XHTML DTD parses again; corrected SAX entity handling

patch-204

- Renamed package XML to CXML.
- The unparse functions support non-canonical output now.

patch-191 (2004-03-18)

- Initial release.