W3C DOM

CXML implements the DOM Level 2 Core interfaces.  For details on DOM, please refer to the specification.

Parsing into DOM

To parse an XML document into a DOM tree, use the SAX parser with a DOM builder as the SAX handler. Example:

(cxml:parse-file "test.xml" (cxml-dom:make-dom-builder))

Function CXML-DOM:MAKE-DOM-BUILDER ()
Create a SAX handler which builds a DOM document.

This functions returns a DOM builder that will work with the default configuration of the SAX parser and is guaranteed to use characters/strings instead of runes/rods, if that makes a difference on the Lisp in question.

This is the same as rune-dom:make-dom-builder on Lisps with Unicode support, and the same as utf8-dom:make-dom-builder otherwise.

Function RUNE-DOM:MAKE-DOM-BUILDER ()
Create a SAX handler which builds a DOM document using runes and rods.

Function UTF8-DOM:MAKE-DOM-BUILDER ()
(Only on Lisps without Unicode support:) Create a SAX handler which builds a DOM document using UTF-8-encoded strings.

Serializing DOM

To serialize a DOM document, use a SAX serialization sink as the argument to dom:map-document, which generates SAX events for the DOM tree.

Applications dealing with namespaces might want to inject a namespace normalizer into the sink chain.

Function DOM:MAP-DOCUMENT (handler document &key include-xmlns-attributes include-default-values include-doctype)
Traverse a DOM document and call SAX functions as if an XML representation of the document was processed by a SAX parser.

Keyword arguments:

DOM/Lisp mapping

Note that there is no "standard" DOM mapping for Lisp.

DOM is specified in CORBA IDL, but it refrains from using object-oriented IDL features, allowing for a much more natural Lisp implemenation than the the ordinary IDL/Lisp mapping would.  Differences between CXML's DOM and the direct IDL/Lisp mapping: