use xsl to build the html documentation from xml

This commit is contained in:
dlichteblau
2007-02-18 12:35:49 +00:00
parent 2eec88675a
commit 0d67d0719d
12 changed files with 418 additions and 733 deletions

29
README Normal file
View File

@ -0,0 +1,29 @@
Closure XML Parser
An XML parser written in Common Lisp.
Closure XML was written by Gilbert Baumann (unk6 at
rz.uni-karlsruhe.de) as part of the Closure web browser.
Contributions to the parser by
* Henrik Motakef (hmot at henrik-motakef.de)
* David Lichteblau (david@lichteblau.com)
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.
CXML is licensed under Lisp-LGPL.
Send bug reports to cxml-devel@common-lisp.net
(http://common-lisp.net/cgi-bin/mailman/listinfo/cxml-devel)
Documentation
Please refer to http://common-lisp.net/project/cxml/ for details.
The documentation is also available in the doc/ subdirectory of this
source distribution, run `make' in that directory to build HTML
for the XML sources (requires xsltproc).

4
doc/GNUmakefile Normal file
View File

@ -0,0 +1,4 @@
all: dom.html index.html installation.html klacks.html quickstart.html sax.html xmls-compat.html
%.html: %.xml html.xsl
xsltproc html.xsl $< >$@

View File

@ -1,209 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Closure XML</title>
<link rel="stylesheet" type="text/css" href="cxml.css"/>
</head>
<body>
<div class="sidebar">
<div class="sidebar-title">
<a href="README.html">Closure XML</a>
</div>
<div class="sidebar-main">
<ul class="main">
<li>
<a href="installation.html">Installing Closure XML</a>
<ul class="sub">
<li><a href="installation.html#download"><b>Download</b></a></li>
<li><a href="installation.html#implementations">Implementation-specific notes</a></li>
<li><a href="installation.html#compilation">Compilation</a></li>
<li><a href="installation.html#tests">Tests</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li>
<a href="quickstart.html"><b>Quick-Start Example</b></a>
</li>
</ul>
</li>
<li>
<a href="using.html">SAX parser</a>
<ul class="sub">
<li><a href="using.html#parser">Parsing and Validating</a></li>
<li><a href="using.html#serialization">Serialization</a></li>
<li><a href="using.html#misc">Miscellaneous SAX handlers</a></li>
<li><a href="using.html#rods">Recoders</a></li>
<li><a href="using.html#dtdcache">Caching of DTD Objects</a></li>
<li><a href="using.html#catalogs">XML Catalogs</a></li>
<li><a href="using.html#sax">SAX Interface</a></li>
</ul>
</li>
<li>
<a href="dom.html">DOM implementation</a>
<ul class="sub">
<li><a href="dom.html#parser">Parsing with the DOM builder</a></li>
<li><a href="dom.html#serialization">Serialization</a></li>
<li><a href="dom.html#mapping">DOM/Lisp mapping</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li><a href="xmls-compat.html">XMLS Builder</a></li>
</ul>
</li>
</ul>
</div>
</div>
<h1>The DOM implementation</h1>
<p>
CXML implements the DOM Level 2 Core interfaces.&nbsp; For details
on DOM, please refer to the <a
href="http://www.w3.org/TR/DOM-Level-2-Core/core.html">specification</a>.
</p>
<a name="parser"/>
<h3>Parsing into DOM</h3>
<p>
To parse an XML document into a DOM tree, use the SAX parser with a
DOM builder as the SAX handler. Example:
</p>
<pre>(cxml:parse-file "test.xml" (cxml-dom:make-dom-builder))</pre>
<p>
<div class="def">Function CXML-DOM:MAKE-DOM-BUILDER ()</div>
Create a SAX handler which builds a DOM document.
<p>
</p>
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.
<p>
</p>
This is the same as <tt>rune-dom:make-dom-builder</tt> on Lisps
with Unicode support, and the same as
<tt>utf8-dom:make-dom-builder</tt> otherwise.
</p>
<p>
<div class="def">Function RUNE-DOM:MAKE-DOM-BUILDER ()</div>
Create a SAX handler which builds a DOM document using runes and rods.
</p>
<p>
<div class="def">Function UTF8-DOM:MAKE-DOM-BUILDER ()</div>
(Only on Lisps without Unicode support:)
Create a SAX handler which builds a DOM document using
UTF-8-encoded strings.
</p>
<a name="serialization"/>
<h3>Serializing DOM</h3>
<p>
To serialize a DOM document, use a SAX serialization sink as the
argument to <tt>dom:map-document</tt>, which generates SAX events
for the DOM tree.
</p>
<p>
Applications dealing with namespaces might want to inject a
<a href="using.html#misc">namespace normalizer</a> into the
sink chain.
</p>
<p>
<div class="def">Function DOM:MAP-DOCUMENT (handler document &key include-xmlns-attributes include-default-values include-doctype)</div>
Traverse a DOM document and call SAX functions as if an XML
representation of the document was processed by a SAX parser.
</p>
<p>Keyword arguments:</p>
<ul>
<li>
<tt>include-xmlns-attributes</tt> -- defaults to
<tt>sax:*include-xmlns-attributes*</tt>
</li>
<li>
<tt>include-doctype</tt> -- One of <tt>nil</tt> (no doctype
declaration), <tt>:full-internal-subset</tt> (include a doctype
declaration and the full internal subset), or
<tt>:canonical-notations</tt> (write a doctype declaration
with an internal subset including only notations, as required
for canonical serialization).
</li>
<li>
<tt>include-default-values</tt> -- include attribute nodes with nil
<tt>dom:specified</tt>.
</li>
<li>
<tt>recode</tt> -- (ignored on Lisps with Unicode support.) If
true, recode UTF-8 strings to rods. Defaults to true if used
with a UTF-8 DOM document. It can be set to false manually to
suppress recoding in this case.
</li>
</ul>
<a name="mapping"/>
<h3>DOM/Lisp mapping</h3>
<p>
Note that there is no "standard" DOM mapping for Lisp.
</p>
<p>
DOM is <a
href="http://www.w3.org/TR/DOM-Level-2-Core/idl-definitions.html">specified
in CORBA IDL</a>, 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.&nbsp;
Differences between CXML's DOM and the direct IDL/Lisp mapping:
</p>
<ul>
<li>
DOM function names are symbols in the <tt>DOM</tt> package (not
the <tt>OP</tt> package).
</li>
<li>
DOM functions have proper required arguments, not a huge
<tt>&rest</tt> lambda list.
</li>
<li>
Although most IDL interfaces are implemented as CLOS classes by
CXML, the Lisp types of DOM objects is not documented and cannot
be relied upon.&nbsp; A node's type can be determined using
<tt>dom:node-type</tt> instead.
</li>
<li>
<tt>DOMString</tt> is mapped to <tt>rod</tt>, which is either
an <tt>(unsigned-byte 16)</tt> array type or a string type.
</li>
<li>
The IDL/Lisp mapping maps CORBA enums to Lisp keywords.&nbsp;
Unfortunately, the DOM IDL does not use enums.&nbsp; Instead,
both exception types and node types are defined integer
constants.&nbsp; CXML chooses to ignore this definition and uses
keywords instead.
</li>
<li>
DOM uses StudlyCaps.&nbsp; Lisp programmers don't.&nbsp; We
insert <tt>#\-</tt> before every upper case letter preceded by a
lower case letter and before every upper case letter which is
followed by a lower case letter, but preceded by a capital
letter.&nbsp; This algorithms leads to the natural Lisp spelling
of DOM function names.
</li>
<li>
Implementation note: DOM's <tt>NodeList</tt> does not
necessarily map to a native "sequence" type.&nbsp; (For example,
node lists are objects in Java, not arrays.)&nbsp;
<tt>NodeList</tt> is specified to reflect changes done after a
node list was created, so node lists cannot be Lisp lists.&nbsp;
(A node list could be implemented as a CLOS object pointing to
said list though.)&nbsp; Instead, CXML currently implements node
lists as adjustable vectors.&nbsp; Note that code which relies on
this implementation and uses Lisp sequence functions
instead of sticking to <tt>dom:item</tt> and <tt>dom:length</tt>
is not portable.&nbsp; As a compromise, you can use our
extensions <tt>dom:map-node-list</tt> or
<tt>dom:do-node-list</tt>, which can be implemented portably.
</li>
</ul>
</body>
</html>

150
doc/dom.xml Normal file
View File

@ -0,0 +1,150 @@
<documentation title="CXML W3C DOM">
<h1>W3C DOM</h1>
<p>
CXML implements the DOM Level 2 Core interfaces.&#160; For details
on DOM, please refer to the <a
href="http://www.w3.org/TR/DOM-Level-2-Core/core.html">specification</a>.
</p>
<a name="parser"/>
<h3>Parsing into DOM</h3>
<p>
To parse an XML document into a DOM tree, use the SAX parser with a
DOM builder as the SAX handler. Example:
</p>
<pre>(cxml:parse-file "test.xml" (cxml-dom:make-dom-builder))</pre>
<p>
<div class="def">Function CXML-DOM:MAKE-DOM-BUILDER ()</div>
Create a SAX handler which builds a DOM document.
<p>
</p>
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.
<p>
</p>
This is the same as <tt>rune-dom:make-dom-builder</tt> on Lisps
with Unicode support, and the same as
<tt>utf8-dom:make-dom-builder</tt> otherwise.
</p>
<p>
<div class="def">Function RUNE-DOM:MAKE-DOM-BUILDER ()</div>
Create a SAX handler which builds a DOM document using runes and rods.
</p>
<p>
<div class="def">Function UTF8-DOM:MAKE-DOM-BUILDER ()</div>
(Only on Lisps without Unicode support:)
Create a SAX handler which builds a DOM document using
UTF-8-encoded strings.
</p>
<a name="serialization"/>
<h3>Serializing DOM</h3>
<p>
To serialize a DOM document, use a SAX serialization sink as the
argument to <tt>dom:map-document</tt>, which generates SAX events
for the DOM tree.
</p>
<p>
Applications dealing with namespaces might want to inject a
<a href="sax.html#misc">namespace normalizer</a> into the
sink chain.
</p>
<p>
<div class="def">Function DOM:MAP-DOCUMENT (handler document &amp;key include-xmlns-attributes include-default-values include-doctype)</div>
Traverse a DOM document and call SAX functions as if an XML
representation of the document was processed by a SAX parser.
</p>
<p>Keyword arguments:</p>
<ul>
<li>
<tt>include-xmlns-attributes</tt> -- defaults to
<tt>sax:*include-xmlns-attributes*</tt>
</li>
<li>
<tt>include-doctype</tt> -- One of <tt>nil</tt> (no doctype
declaration), <tt>:full-internal-subset</tt> (include a doctype
declaration and the full internal subset), or
<tt>:canonical-notations</tt> (write a doctype declaration
with an internal subset including only notations, as required
for canonical serialization).
</li>
<li>
<tt>include-default-values</tt> -- include attribute nodes with nil
<tt>dom:specified</tt>.
</li>
<li>
<tt>recode</tt> -- (ignored on Lisps with Unicode support.) If
true, recode UTF-8 strings to rods. Defaults to true if used
with a UTF-8 DOM document. It can be set to false manually to
suppress recoding in this case.
</li>
</ul>
<a name="mapping"/>
<h3>DOM/Lisp mapping</h3>
<p>
Note that there is no "standard" DOM mapping for Lisp.
</p>
<p>
DOM is <a
href="http://www.w3.org/TR/DOM-Level-2-Core/idl-definitions.html">specified
in CORBA IDL</a>, 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.&#160;
Differences between CXML's DOM and the direct IDL/Lisp mapping:
</p>
<ul>
<li>
DOM function names are symbols in the <tt>DOM</tt> package (not
the <tt>OP</tt> package).
</li>
<li>
DOM functions have proper required arguments, not a huge
<tt>&amp;rest</tt> lambda list.
</li>
<li>
Although most IDL interfaces are implemented as CLOS classes by
CXML, the Lisp types of DOM objects is not documented and cannot
be relied upon.&#160; A node's type can be determined using
<tt>dom:node-type</tt> instead.
</li>
<li>
<tt>DOMString</tt> is mapped to <tt>rod</tt>, which is either
an <tt>(unsigned-byte 16)</tt> array type or a string type.
</li>
<li>
The IDL/Lisp mapping maps CORBA enums to Lisp keywords.&#160;
Unfortunately, the DOM IDL does not use enums.&#160; Instead,
both exception types and node types are defined integer
constants.&#160; CXML chooses to ignore this definition and uses
keywords instead.
</li>
<li>
DOM uses StudlyCaps.&#160; Lisp programmers don't.&#160; We
insert <tt>#\-</tt> before every upper case letter preceded by a
lower case letter and before every upper case letter which is
followed by a lower case letter, but preceded by a capital
letter.&#160; This algorithms leads to the natural Lisp spelling
of DOM function names.
</li>
<li>
Implementation note: DOM's <tt>NodeList</tt> does not
necessarily map to a native "sequence" type.&#160; (For example,
node lists are objects in Java, not arrays.)&#160;
<tt>NodeList</tt> is specified to reflect changes done after a
node list was created, so node lists cannot be Lisp lists.&#160;
(A node list could be implemented as a CLOS object pointing to
said list though.)&#160; Instead, CXML currently implements node
lists as adjustable vectors.&#160; Note that code which relies on
this implementation and uses Lisp sequence functions
instead of sticking to <tt>dom:item</tt> and <tt>dom:length</tt>
is not portable.&#160; As a compromise, you can use our
extensions <tt>dom:map-node-list</tt> or
<tt>dom:do-node-list</tt>, which can be implemented portably.
</li>
</ul>
</documentation>

85
doc/html.xsl Normal file
View File

@ -0,0 +1,85 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"
indent="yes"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="documentation">
<html>
<head>
<title>
<xsl:value-of select="@title"/>
</title>
<link rel="stylesheet" type="text/css" href="cxml.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<div class="sidebar">
<div class="sidebar-title">
<a href="index.html">Closure XML</a>
</div>
<div class="sidebar-main">
<ul class="main">
<li>
<a href="installation.html">Installing Closure XML</a>
<ul class="sub">
<li><a href="installation.html#download"><b>Download</b></a></li>
<li><a href="installation.html#implementations">Implementation-specific notes</a></li>
<li><a href="installation.html#compilation">Compilation</a></li>
<li><a href="installation.html#tests">Tests</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li>
<a href="quickstart.html"><b>Quick-Start Example</b></a>
</li>
</ul>
</li>
<li>
<a href="sax.html">SAX parsing and serialization</a>
<ul class="sub">
<li><a href="sax.html#parser">Parsing and Validating</a></li>
<li><a href="sax.html#serialization">Serialization</a></li>
<li><a href="sax.html#misc">Miscellaneous SAX handlers</a></li>
<li><a href="sax.html#rods">Recoders</a></li>
<li><a href="sax.html#dtdcache">Caching of DTD Objects</a></li>
<li><a href="sax.html#catalogs">XML Catalogs</a></li>
<li><a href="sax.html#sax">SAX Interface</a></li>
</ul>
</li>
<li>
<a href="klacks.html">Klacks parser</a>
<ul class="sub">
<li><a href="klacks.html#parsing">Parsing incrementally</a></li>
<li><a href="klacks.html#sax">Bridging Klacks and SAX</a></li>
</ul>
</li>
<li>
<a href="dom.html">DOM implementation</a>
<ul class="sub">
<li><a href="dom.html#parser">Parsing with the DOM builder</a></li>
<li><a href="dom.html#serialization">Serialization</a></li>
<li><a href="dom.html#mapping">DOM/Lisp mapping</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li><a href="xmls-compat.html">XMLS Builder</a></li>
</ul>
</li>
</ul>
</div>
</div>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@ -1,62 +1,4 @@
<?xml version="1.0" encoding="iso-8859-1"?> <documentation title="Closure XML">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Closure XML</title>
<link rel="stylesheet" type="text/css" href="doc/cxml.css"/>
</head>
<body>
<div class="sidebar">
<div class="sidebar-title">
<a href="README.html">Closure XML</a>
</div>
<div class="sidebar-main">
<ul class="main">
<li>
<a href="doc/installation.html">Installing Closure XML</a>
<ul class="sub">
<li><a href="doc/installation.html#download"><b>Download</b></a></li>
<li><a href="doc/installation.html#implementations">Implementation-specific notes</a></li>
<li><a href="doc/installation.html#compilation">Compilation</a></li>
<li><a href="doc/installation.html#tests">Tests</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li>
<a href="doc/quickstart.html"><b>Quick-Start Example</b></a>
</li>
</ul>
</li>
<li>
<a href="doc/using.html">SAX parser</a>
<ul class="sub">
<li><a href="doc/using.html#parser">Parsing and Validating</a></li>
<li><a href="doc/using.html#serialization">Serialization</a></li>
<li><a href="doc/using.html#misc">Miscellaneous SAX handlers</a></li>
<li><a href="doc/using.html#rods">Recoders</a></li>
<li><a href="doc/using.html#dtdcache">Caching of DTD Objects</a></li>
<li><a href="doc/using.html#catalogs">XML Catalogs</a></li>
<li><a href="doc/using.html#sax">SAX Interface</a></li>
</ul>
</li>
<li>
<a href="doc/dom.html">DOM implementation</a>
<ul class="sub">
<li><a href="doc/dom.html#parser">Parsing with the DOM builder</a></li>
<li><a href="doc/dom.html#serialization">Serialization</a></li>
<li><a href="doc/dom.html#mapping">DOM/Lisp mapping</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li><a href="doc/xmls-compat.html">XMLS Builder</a></li>
</ul>
</li>
</ul>
</div>
</div>
<h1>Closure XML Parser</h1> <h1>Closure XML Parser</h1>
<p>An XML parser written in Common Lisp.</p> <p>An XML parser written in Common Lisp.</p>
@ -87,9 +29,9 @@
CXML implements a <a CXML implements a <a
href="http://www.w3.org/TR/REC-xml-names/">namespace-aware</a>, href="http://www.w3.org/TR/REC-xml-names/">namespace-aware</a>,
validating <a validating <a
href="http://www.w3.org/TR/2000/REC-xml-20001006">XML&nbsp;1.0</a> href="http://www.w3.org/TR/2000/REC-xml-20001006">XML&#160;1.0</a>
parser as well as the <a parser as well as the <a
href="http://www.w3.org/TR/DOM-Level-2-Core/">DOM&nbsp;Level&nbsp;2&nbsp;Core</a> href="http://www.w3.org/TR/DOM-Level-2-Core/">DOM&#160;Level&#160;2&#160;Core</a>
interfaces. Two parser interfaces are offered, one SAX-like, the interfaces. Two parser interfaces are offered, one SAX-like, the
other similar to StAX. other similar to StAX.
</p> </p>
@ -170,54 +112,4 @@
<ul class="nomargin"> <ul class="nomargin">
<li>Initial release.</li> <li>Initial release.</li>
</ul> </ul>
</documentation>
<!--
<a name="todo"/>
<h2>To Do</h2>
<ul>
<li>
<strike>David's changes might have affected performance.&nbsp; Some
benchmarking needs to be done here.</strike> (The actual parser
seems to be faster than xmls - - good enough for me.)
</li>
<li>
DOM in general is pretty heavyweight.&nbsp; There is/was a
"simple-dom" which should be faster.&nbsp; This might be worth
reviving.
</li>
<li>
<strike>For those who don't like DOM at all, it would be a very simple
exercise to write a SAX handler for "Lisp-XML" output instead of
DOM.</strike> (done)
<li>
<strike>The serializer supports only <a
href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">Canonical
XML</a> right now.</strike>&nbsp; In the future we want support for:
<strike>Including doctype declarations in the output</strike>
(done), <strike>ordinary output with less character reference
noise</strike> (done), <strike>optional indentation</strike>
(done), user-specified encoding, etc.
</li>
<li>
<strike>There are still thread-safety issues.</strike> (fixed)
</li>
<li>
<strike>Validation!</strike> (done)
</li>
<li>
Upgrade to DOM Level 2 for complete namespace support.
</li>
<li>
Unless <tt>rune-is-character</tt> is enabled, rod hashing
currently uses <tt>equalp</tt> hash tables, which can be very slow.
(See <tt>%make-rod-hash-table</tt>.)
</li>
</ul>
<p>
(Compare also with Gilbert Baumann's older TODO list in
<tt>xml-parse.lisp</tt>.)
</p>
-->
</body>
</html>

View File

@ -1,61 +1,4 @@
<?xml version="1.0" encoding="iso-8859-1"?> <documentation title="CXML Installation">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Closure XML</title>
<link rel="stylesheet" type="text/css" href="cxml.css"/>
</head>
<body>
<div class="sidebar">
<div class="sidebar-title">
<a href="README.html">Closure XML</a>
</div>
<div class="sidebar-main">
<ul class="main">
<li>
<a href="installation.html">Installing Closure XML</a>
<ul class="sub">
<li><a href="installation.html#download"><b>Download</b></a></li>
<li><a href="installation.html#implementations">Implementation-specific notes</a></li>
<li><a href="installation.html#compilation">Compilation</a></li>
<li><a href="installation.html#tests">Tests</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li>
<a href="quickstart.html"><b>Quick-Start Example</b></a>
</li>
</ul>
</li>
<li>
<a href="using.html">SAX parser</a>
<ul class="sub">
<li><a href="using.html#parser">Parsing and Validating</a></li>
<li><a href="using.html#serialization">Serialization</a></li>
<li><a href="using.html#misc">Miscellaneous SAX handlers</a></li>
<li><a href="using.html#rods">Recoders</a></li>
<li><a href="using.html#dtdcache">Caching of DTD Objects</a></li>
<li><a href="using.html#catalogs">XML Catalogs</a></li>
<li><a href="using.html#sax">SAX Interface</a></li>
</ul>
</li>
<li>
<a href="dom.html">DOM implementation</a>
<ul class="sub">
<li><a href="dom.html#parser">Parsing with the DOM builder</a></li>
<li><a href="dom.html#serialization">Serialization</a></li>
<li><a href="dom.html#mapping">DOM/Lisp mapping</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li><a href="xmls-compat.html">XMLS Builder</a></li>
</ul>
</li>
</ul>
</div>
</div>
<h1>Installation of Closure XML</h1> <h1>Installation of Closure XML</h1>
<a name="download"/> <a name="download"/>
@ -123,7 +66,7 @@ $ cvs co cxml</pre>
$ cvs login # password is "anonymous" $ cvs login # password is "anonymous"
$ cvs co 2001/XML-Test-Suite/xmlconf $ cvs co 2001/XML-Test-Suite/xmlconf
$ cvs co -D '2005-05-06 23:00' 2001/DOM-Test-Suite $ cvs co -D '2005-05-06 23:00' 2001/DOM-Test-Suite
$ cd 2001/DOM-Test-Suite && ant dom1-dtd dom2-dtd</pre> $ cd 2001/DOM-Test-Suite &amp;&amp; ant dom1-dtd dom2-dtd</pre>
<p> <p>
Omit <tt>-D</tt> to get the latest version, which may not work Omit <tt>-D</tt> to get the latest version, which may not work
with cxml yet. The <tt>ant</tt> step is necessary to run the DOM with cxml yet. The <tt>ant</tt> step is necessary to run the DOM
@ -144,7 +87,7 @@ $ cd 2001/DOM-Test-Suite && ant dom1-dtd dom2-dtd</pre>
<p> <p>
<b>fixme</b> domtest.lisp does not understand the current <b>fixme</b> domtest.lisp does not understand the current
testsuite driver anymore.&nbsp; To fix this problem, revert the testsuite driver anymore.&#160; To fix this problem, revert the
affected files manually after check-out: affected files manually after check-out:
</p> </p>
@ -153,10 +96,9 @@ xmltest$ patch -p0 -R &lt;/path/to/cxml/test/xmlconf-base.diff</pre>
<p> <p>
The log message for the changes reads "<i>Removed unnecessary The log message for the changes reads "<i>Removed unnecessary
xml:base attribute</i>".&nbsp; If I understand correctly, only xml:base attribute</i>".&#160; If I understand correctly, only
DOM&nbsp;3 parsers provide the baseURI attribute necessary for DOM&#160;3 parsers provide the baseURI attribute necessary for
understanding <tt>xmlconf.xml</tt> now.&nbsp; We don't have that understanding <tt>xmlconf.xml</tt> now.&#160; We don't have that
yet. yet.
</p> </p>
</body> </documentation>
</html>

View File

@ -1,69 +1,4 @@
<?xml version="1.0" encoding="iso-8859-1"?> <documentation title="CXML Klacks parser">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Closure XML</title>
<link rel="stylesheet" type="text/css" href="cxml.css"/>
</head>
<body>
<div class="sidebar">
<div class="sidebar-title">
<a href="README.html">Closure XML</a>
</div>
<div class="sidebar-main">
<ul class="main">
<li>
<a href="installation.html">Installing Closure XML</a>
<ul class="sub">
<li><a href="installation.html#download"><b>Download</b></a></li>
<li><a href="installation.html#implementations">Implementation-specific notes</a></li>
<li><a href="installation.html#compilation">Compilation</a></li>
<li><a href="installation.html#tests">Tests</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li>
<a href="quickstart.html"><b>Quick-Start Example</b></a>
</li>
</ul>
</li>
<li>
<a href="using.html">SAX parser</a>
<ul class="sub">
<li><a href="using.html#parser">Parsing and Validating</a></li>
<li><a href="using.html#serialization">Serialization</a></li>
<li><a href="using.html#misc">Miscellaneous SAX handlers</a></li>
<li><a href="using.html#rods">Recoders</a></li>
<li><a href="using.html#dtdcache">Caching of DTD Objects</a></li>
<li><a href="using.html#catalogs">XML Catalogs</a></li>
<li><a href="using.html#sax">SAX Interface</a></li>
</ul>
</li>
<li>
<a href="klacks.html">Klacks parser</a>
<ul class="hack">
<li><a href="klacks.html#parsing">Parsing incrementally</a></li>
<li><a href="klacks.html#sax">Bridging Klacks and SAX</a></li>
</ul>
</li>
<li>
<a href="dom.html">DOM implementation</a>
<ul class="sub">
<li><a href="dom.html#parser">Parsing with the DOM builder</a></li>
<li><a href="dom.html#serialization">Serialization</a></li>
<li><a href="dom.html#mapping">DOM/Lisp mapping</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li><a href="xmls-compat.html">XMLS Builder</a></li>
</ul>
</li>
</ul>
</div>
</div>
<h1>Klacks parser</h1> <h1>Klacks parser</h1>
<p> <p>
The Klacks parser provides an alternative parsing interface, The Klacks parser provides an alternative parsing interface,
@ -115,7 +50,7 @@ NIL</pre>
To parse using Klacks, create an XML <tt>source</tt> first. To parse using Klacks, create an XML <tt>source</tt> first.
</p> </p>
<p> <p>
<div class="def">Function CXML:MAKE-SOURCE (input &key validate <div class="def">Function CXML:MAKE-SOURCE (input &amp;key validate
dtd root entity-resolver disallow-external-subset pathname)</div> dtd root entity-resolver disallow-external-subset pathname)</div>
Create and return a source for <tt>input</tt>. Create and return a source for <tt>input</tt>.
</p> </p>
@ -163,7 +98,7 @@ NIL</pre>
<p> <p>
<b>Keyword arguments</b> have the same meaning as with the SAX parser, <b>Keyword arguments</b> have the same meaning as with the SAX parser,
please refer to the documentation of <a please refer to the documentation of <a
href="using.html#parser">parse-file</a> for more information: href="sax.html#parser">parse-file</a> for more information:
</p> </p>
<ul> <ul>
<li> <li>
@ -195,7 +130,6 @@ NIL</pre>
<p> <p>
Events are read from the stream using the following functions: Events are read from the stream using the following functions:
</p> </p>
<p>
<div class="def">Function KLACKS:PEEK (source)</div> <div class="def">Function KLACKS:PEEK (source)</div>
<p> => :start-document<br/> <p> => :start-document<br/>
or => :start-document, version, encoding, standalonep<br/> or => :start-document, version, encoding, standalonep<br/>
@ -275,11 +209,10 @@ NIL</pre>
Close all streams referred to by <tt>source</tt>. Close all streams referred to by <tt>source</tt>.
</p> </p>
<p> <p>
<div class="def">Macro KLACKS:WITH-OPEN-SOURCE ((var source) &body body)</div> <div class="def">Macro KLACKS:WITH-OPEN-SOURCE ((var source) &amp;body body)</div>
Evaluate <tt>source</tt> to create a source object, bind it to Evaluate <tt>source</tt> to create a source object, bind it to
symbol <tt>var</tt> and evaluate <tt>body</tt> as an implicit progn. symbol <tt>var</tt> and evaluate <tt>body</tt> as an implicit progn.
Call <tt>klacks:close-source</tt> to close the source after Call <tt>klacks:close-source</tt> to close the source after
exiting <tt>body</tt>, whether normally or abnormally. exiting <tt>body</tt>, whether normally or abnormally.
</p> </p>
</body> </documentation>
</html>

View File

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Closure XML</title>
<link rel="stylesheet" type="text/css" href="cxml.css"/>
</head>
<body>
<div class="sidebar">
<div class="sidebar-title">
<a href="README.html">Closure XML</a>
</div>
<div class="sidebar-main">
<ul class="main">
<li>
<a href="installation.html">Installing Closure XML</a>
<ul class="sub">
<li><a href="installation.html#download"><b>Download</b></a></li>
<li><a href="installation.html#implementations">Implementation-specific notes</a></li>
<li><a href="installation.html#compilation">Compilation</a></li>
<li><a href="installation.html#tests">Tests</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li>
<a href="quickstart.html"><b>Quick-Start Example</b></a>
</li>
</ul>
</li>
<li>
<a href="using.html">SAX parser</a>
<ul class="sub">
<li><a href="using.html#parser">Parsing and Validating</a></li>
<li><a href="using.html#serialization">Serialization</a></li>
<li><a href="using.html#misc">Miscellaneous SAX handlers</a></li>
<li><a href="using.html#rods">Recoders</a></li>
<li><a href="using.html#dtdcache">Caching of DTD Objects</a></li>
<li><a href="using.html#catalogs">XML Catalogs</a></li>
<li><a href="using.html#sax">SAX Interface</a></li>
</ul>
</li>
<li>
<a href="dom.html">DOM implementation</a>
<ul class="sub">
<li><a href="dom.html#parser">Parsing with the DOM builder</a></li>
<li><a href="dom.html#serialization">Serialization</a></li>
<li><a href="dom.html#mapping">DOM/Lisp mapping</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li><a href="xmls-compat.html">XMLS Builder</a></li>
</ul>
</li>
</ul>
</div>
</div>
<h1>Quick-Start Example</h1>
<p>
Make sure to <a href="installation.html#installation">install and load</a> cxml first.
</p>
<p>Create a test file called <tt>example.xml</tt>:</p>
<pre>* <b>(with-open-file (s "example.xml" :direction :output)
(write-string "&lt;test a='b'&gt;&lt;child/&gt;&lt;/test>" s))</b></pre>
<p>Parse <tt>example.xml</tt> into a DOM tree (<a href="using.html#parser">read
more</a>):</p>
<pre>* <b>(cxml:parse-file "example.xml" (cxml-dom:make-dom-builder))</b>
#&lt;DOM-IMPL::DOCUMENT @ #x72206172>
;; save result for later:
* <b>(defparameter *example* *)</b>
*EXAMPLE*</pre>
<p>Inspect the DOM tree (<a href="using.html#dom">read more</a>):</p>
<pre>* <b>(dom:document-element *example*)</b>
#&lt;DOM-IMPL::ELEMENT test @ #x722b6ba2&gt;
* <b>(dom:tag-name (dom:document-element *example*))</b>
"test"
* <b>(dom:child-nodes (dom:document-element *example*))</b>
#(#&lt;DOM-IMPL::ELEMENT child @ #x722b6d8a&gt;)
* <b>(dom:get-attribute (dom:document-element *example*) "a")</b>
"b"</pre>
<p>Serialize the DOM document back into a file (<a
href="using.html#serialization">read more</a>):</p>
<pre><b>(with-open-file (out "example.out" :direction :output :element-type '(unsigned-byte 8))
(dom:map-document (cxml:make-octet-stream-sink out) *example*))</b></pre>
<p>As an alternative to DOM, parse into xmls-compatible list
structure (<a href="xmls-compat.html">read more</a>):</p>
<pre>* <b>(cxml:parse-file "example.xml" (cxml-xmls:make-xmls-builder))</b>
("test" (("a" "b")) ("child" NIL))</pre>
<p>Use klacks to read events from the parser incrementally. The
following example looks only for :start-element and :end-element
events and prints them (<a href="klacks.html">read more</a>):</p>
<pre>* <b>(klacks:with-open-source
(s (cxml:make-source #p"example.xml"))
(loop
for key = (klacks:peek s)
while key
do
(case key
(:start-element
(format t "~A {" (klacks:current-qname s)))
(:end-element
(format t "}")))
(klacks:consume s)))</b>
test {child {}}</pre>
</body>
</html>

56
doc/quickstart.xml Normal file
View File

@ -0,0 +1,56 @@
<documentation title="CXML Quick-Start Example">
<h1>Quick-Start Example</h1>
<p>
Make sure to <a href="installation.html#installation">install and load</a> cxml first.
</p>
<p>Create a test file called <tt>example.xml</tt>:</p>
<pre>* <b>(with-open-file (s "example.xml" :direction :output)
(write-string "&lt;test a='b'&gt;&lt;child/&gt;&lt;/test>" s))</b></pre>
<p>Parse <tt>example.xml</tt> into a DOM tree (<a href="sax.html#parser">read
more</a>):</p>
<pre>* <b>(cxml:parse-file "example.xml" (cxml-dom:make-dom-builder))</b>
#&lt;DOM-IMPL::DOCUMENT @ #x72206172>
;; save result for later:
* <b>(defparameter *example* *)</b>
*EXAMPLE*</pre>
<p>Inspect the DOM tree (<a href="sax.html#dom">read more</a>):</p>
<pre>* <b>(dom:document-element *example*)</b>
#&lt;DOM-IMPL::ELEMENT test @ #x722b6ba2&gt;
* <b>(dom:tag-name (dom:document-element *example*))</b>
"test"
* <b>(dom:child-nodes (dom:document-element *example*))</b>
#(#&lt;DOM-IMPL::ELEMENT child @ #x722b6d8a&gt;)
* <b>(dom:get-attribute (dom:document-element *example*) "a")</b>
"b"</pre>
<p>Serialize the DOM document back into a file (<a
href="sax.html#serialization">read more</a>):</p>
<pre><b>(with-open-file (out "example.out" :direction :output :element-type '(unsigned-byte 8))
(dom:map-document (cxml:make-octet-stream-sink out) *example*))</b></pre>
<p>As an alternative to DOM, parse into xmls-compatible list
structure (<a href="xmls-compat.html">read more</a>):</p>
<pre>* <b>(cxml:parse-file "example.xml" (cxml-xmls:make-xmls-builder))</b>
("test" (("a" "b")) ("child" NIL))</pre>
<p>Use klacks to read events from the parser incrementally. The
following example looks only for :start-element and :end-element
events and prints them (<a href="klacks.html">read more</a>):</p>
<pre>* <b>(klacks:with-open-source
(s (cxml:make-source #p"example.xml"))
(loop
for key = (klacks:peek s)
while key
do
(case key
(:start-element
(format t "~A {" (klacks:current-qname s)))
(:end-element
(format t "}")))
(klacks:consume s)))</b>
test {child {}}</pre>
</documentation>

View File

@ -1,76 +1,54 @@
<?xml version="1.0" encoding="iso-8859-1"?> <documentation title="CXML SAX parser">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <h1>SAX parsing and serialization</h1>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Closure XML</title>
<link rel="stylesheet" type="text/css" href="cxml.css"/>
</head>
<body>
<div class="sidebar">
<div class="sidebar-title">
<a href="README.html">Closure XML</a>
</div>
<div class="sidebar-main">
<ul class="main">
<li>
<a href="installation.html">Installing Closure XML</a>
<ul class="sub">
<li><a href="installation.html#download"><b>Download</b></a></li>
<li><a href="installation.html#implementations">Implementation-specific notes</a></li>
<li><a href="installation.html#compilation">Compilation</a></li>
<li><a href="installation.html#tests">Tests</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li>
<a href="quickstart.html"><b>Quick-Start Example</b></a>
</li>
</ul>
</li>
<li>
<a href="using.html">SAX parser</a>
<ul class="sub">
<li><a href="using.html#parser">Parsing and Validating</a></li>
<li><a href="using.html#serialization">Serialization</a></li>
<li><a href="using.html#misc">Miscellaneous SAX handlers</a></li>
<li><a href="using.html#rods">Recoders</a></li>
<li><a href="using.html#dtdcache">Caching of DTD Objects</a></li>
<li><a href="using.html#catalogs">XML Catalogs</a></li>
<li><a href="using.html#sax">SAX Interface</a></li>
</ul>
</li>
<li>
<a href="dom.html">DOM implementation</a>
<ul class="sub">
<li><a href="dom.html#parser">Parsing with the DOM builder</a></li>
<li><a href="dom.html#serialization">Serialization</a></li>
<li><a href="dom.html#mapping">DOM/Lisp mapping</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li><a href="xmls-compat.html">XMLS Builder</a></li>
</ul>
</li>
</ul>
</div>
</div>
<h1>Using the SAX parser</h1>
<a name="parser"/> <a name="parser"/>
<h3>Parsing and Validating</h3>
<p> <p>
CXML is implemented as a SAX parser. (Refer to <a This chapter describes CXML's SAX-like parser interface.
href="dom.html#parser">make-dom-builder</a> for information about
DOM.)
</p> </p>
<p> <p>
<div class="def">Function CXML:PARSE-FILE (pathname handler &key ...)</div> The SAX layer is an important concept in CXML that users will
<div class="def">Function CXML:PARSE-STREAM (stream handler &key ...)</div> encounter in various situations:
<div class="def">Function CXML:PARSE-OCTETS (octets handler &key ...)</div> </p>
<div class="def">Function CXML:PARSE-ROD (rod handler &key ...)</div> <ul>
Parse an XML document.&nbsp; <li>
To <b>parse into DOM</b>, use the SAX parser as described below with
a <b>DOM builder</b> as the SAX handler. (Refer to <a
href="dom.html#parser">make-dom-builder</a> for information about
DOM.)
</li>
<li>
<b>Serialization</b> is done using SAX, too. SAX handlers that
process and consume events without sending them to another
handler are called <i>sinks</i> in CXML. Serialization sinks
write XML output for the events they receive. For example, to
serialize DOM, use <tt>map-document</tt> to turn the DOM
document into SAX events together with a <tt>sink</tt> for
serialization.
</li>
<li>
SAX handlers can be chained together. Various SAX handlers
are offered that can be used in this way, transforming SAX
events before handing them to the next handler. This includes
handlers for <b>whitespace removal</b>, <b>namespace
normalization</b>, and rod-to-string <b>recoding</b>.
</li>
</ul>
<p>
However, SAX events are easier to generate than to process. That
is why CXML offers <i>Klacks</i>, a "pull-based" API in addition to SAX.
Klacks events are generally easier to process than to generate.
Please refer to the <a href="klacks.html">Klacks documentation</a>
for details.
</p>
<h3>Parsing and Validating</h3>
<p>
<div class="def">Function CXML:PARSE-FILE (pathname handler &amp;key ...)</div>
<div class="def">Function CXML:PARSE-STREAM (stream handler &amp;key ...)</div>
<div class="def">Function CXML:PARSE-OCTETS (octets handler &amp;key ...)</div>
<div class="def">Function CXML:PARSE-ROD (rod handler &amp;key ...)</div>
Parse an XML document.&#160;
Return values from this function depend on the SAX handler used.<br/> Return values from this function depend on the SAX handler used.<br/>
Arguments: Arguments:
</p> </p>
@ -86,7 +64,7 @@
</p> </p>
<ul> <ul>
<li> <li>
<tt>validate</tt> -- A boolean.&nbsp; Defaults to <tt>validate</tt> -- A boolean.&#160; Defaults to
<tt>nil</tt>. If true, parse in validating mode, i.e. assert that <tt>nil</tt>. If true, parse in validating mode, i.e. assert that
the document contains a DOCTYPE declaration and conforms to the the document contains a DOCTYPE declaration and conforms to the
DTD declared. DTD declared.
@ -133,7 +111,7 @@
</p> </p>
<p> <p>
<div class="def">Function CXML:PARSE-FILE (uri qname handler &key public-id system-id entity-resolver recode)</div> <div class="def">Function CXML:PARSE-EMPTY-DOCUMENT (uri qname handler &amp;key public-id system-id entity-resolver recode)</div>
</p> </p>
<p> <p>
Simulate parsing a document with a document element <tt>qname</tt> Simulate parsing a document with a document element <tt>qname</tt>
@ -185,9 +163,9 @@
<a name="serialization"/> <a name="serialization"/>
<h3>Serialization</h3> <h3>Serialization</h3>
<p> <p>
Serialization is performed using <tt>sink</tt> objects. A sink Serialization is performed using <tt>sink</tt> objects. There are
is an output stream for runes. There are different kinds of sinks different kinds of sinks for output to lisp streams and vectors in
for output to lisp streams, vectors, etc. various flavours.
</p> </p>
<p> <p>
Technically, sinks are SAX handlers that write XML output for SAX Technically, sinks are SAX handlers that write XML output for SAX
@ -205,17 +183,17 @@
<div style="background-color: #ddddff"> <div style="background-color: #ddddff">
Portable sinks:<br/> Portable sinks:<br/>
<span class="def">Function CXML:MAKE-OCTET-VECTOR-SINK (&rest keys) => sink</span><br/> <span class="def">Function CXML:MAKE-OCTET-VECTOR-SINK (&amp;rest keys) => sink</span><br/>
<span class="def">Function CXML:MAKE-OCTET-STREAM-SINK (stream &rest keys) => sink</span><br/> <span class="def">Function CXML:MAKE-OCTET-STREAM-SINK (stream &amp;rest keys) => sink</span><br/>
<span class="def">Function CXML:MAKE-ROD-SINK (&rest keys) => sink</span><br/> <span class="def">Function CXML:MAKE-ROD-SINK (&amp;rest keys) => sink</span><br/>
<br/> <br/>
Only on Lisps with Unicode support:<br/> Only on Lisps with Unicode support:<br/>
<span class="def">Function CXML:MAKE-STRING-SINK</span> -- alias for <tt>cxml:make-rod-sink</tt><br/> <span class="def">Function CXML:MAKE-STRING-SINK</span> -- alias for <tt>cxml:make-rod-sink</tt><br/>
<span class="def">Function CXML:MAKE-CHARACTER-STREAM-SINK (stream &rest keys) => sink</span><br/> <span class="def">Function CXML:MAKE-CHARACTER-STREAM-SINK (stream &amp;rest keys) => sink</span><br/>
<br/> <br/>
Only on Lisps <em>without</em> Unicode support:<br/> Only on Lisps <em>without</em> Unicode support:<br/>
<span class="def">Function CXML:MAKE-STRING-SINK/UTF8 (&rest keys) => sink</span><br/> <span class="def">Function CXML:MAKE-STRING-SINK/UTF8 (&amp;rest keys) => sink</span><br/>
<span class="def">Function CXML:MAKE-CHARACTER-STREAM-SINK/UTF8 (stream &rest keys) => sink</span><br/> <span class="def">Function CXML:MAKE-CHARACTER-STREAM-SINK/UTF8 (stream &amp;rest keys) => sink</span><br/>
</div> </div>
<p> <p>
Return a SAX serialization handle. Return a SAX serialization handle.
@ -298,22 +276,22 @@
An internal subset will be included in the result regardless of An internal subset will be included in the result regardless of
the <tt>canonical</tt> setting. It is the responsibility of the the <tt>canonical</tt> setting. It is the responsibility of the
caller to not report an internal subset for caller to not report an internal subset for
canonical&nbsp;&lt;=&nbsp;1, or only notations as required for canonical&#160;&lt;=&#160;1, or only notations as required for
canonical&nbsp;=&nbsp;2. For example, the canonical&#160;=&#160;2. For example, the
<tt>include-doctype</tt> argument to <tt>dom:map-document</tt> <tt>include-doctype</tt> argument to <tt>dom:map-document</tt>
should be set to <tt>nil</tt> for the former behaviour and should be set to <tt>nil</tt> for the former behaviour and
<tt>:canonical-notations</tt> for the latter. <tt>:canonical-notations</tt> for the latter.
</p> </p>
<p> <p>
With an <tt>indentation</tt> level, pretty-print the XML by With an <tt>indentation</tt> level, pretty-print the XML by
inserting additional whitespace.&nbsp; Note that indentation inserting additional whitespace.&#160; Note that indentation
changes the document model and should only be used if whitespace changes the document model and should only be used if whitespace
does not matter to the application. does not matter to the application.
</p> </p>
<p> <p>
<div class="def">Macro CXML:WITH-XML-OUTPUT (sink &body body) => sink-specific result</div> <div class="def">Macro CXML:WITH-XML-OUTPUT (sink &amp;body body) => sink-specific result</div>
<div class="def">Macro CXML:WITH-ELEMENT (qname &body body) => result</div> <div class="def">Macro CXML:WITH-ELEMENT (qname &amp;body body) => result</div>
<div class="def">Function CXML:ATTRIBUTE (name value) => value</div> <div class="def">Function CXML:ATTRIBUTE (name value) => value</div>
<div class="def">Function CXML:TEXT (data) => data</div> <div class="def">Function CXML:TEXT (data) => data</div>
<div class="def">Function CXML:CDATA (data) => data</div> <div class="def">Function CXML:CDATA (data) => data</div>
@ -337,7 +315,7 @@
&lt;/foo&gt;</pre> &lt;/foo&gt;</pre>
<p> <p>
<div class="def">Macro XHTML-GENERATOR:WITH-XHTML (sink &rest forms)</div> <div class="def">Macro XHTML-GENERATOR:WITH-XHTML (sink &amp;rest forms)</div>
<div class="def">Macro XHTML-GENERATOR:WRITE-DOCTYPE (sink)</div> <div class="def">Macro XHTML-GENERATOR:WRITE-DOCTYPE (sink)</div>
Macro <tt>with-xhtml</tt> is a modified version of Macro <tt>with-xhtml</tt> is a modified version of
Franz' <tt>htmlgen</tt> works as a SAX driver for XHTML. Franz' <tt>htmlgen</tt> works as a SAX driver for XHTML.
@ -367,8 +345,8 @@
<h3>Miscellaneous SAX handlers</h3> <h3>Miscellaneous SAX handlers</h3>
<p> <p>
<div class="def">Function CXML:MAKE-VALIDATOR (dtd root)</div> <div class="def">Function CXML:MAKE-VALIDATOR (dtd root)</div>
Create a SAX handler which validates against a DTD instance.&nbsp; Create a SAX handler which validates against a DTD instance.&#160;
The document's root element must be named <tt>root</tt>.&nbsp; The document's root element must be named <tt>root</tt>.&#160;
Used with <tt>dom:map-document</tt>, this validates a document Used with <tt>dom:map-document</tt>, this validates a document
object as if by re-reading it with a validating parser, except object as if by re-reading it with a validating parser, except
that declarations recorded in the document instance are completely that declarations recorded in the document instance are completely
@ -403,7 +381,7 @@
handler. handler.
</p> </p>
<p> <p>
<div class="def">Function CXML:MAKE-WHITESPACE-NORMALIZER (chained-handler &optional dtd)</div> <div class="def">Function CXML:MAKE-WHITESPACE-NORMALIZER (chained-handler &amp;optional dtd)</div>
Return a SAX handler which removes whitespace from elements that Return a SAX handler which removes whitespace from elements that
have <em>element content</em> and have not been declared to have <em>element content</em> and have not been declared to
preserve space using an xml:space attribute. preserve space using an xml:space attribute.
@ -544,7 +522,7 @@
to <tt>:public</tt>. to <tt>:public</tt>.
</p> </p>
<p> <p>
<div class="def">Function CXML:MAKE-CATALOG (&optional uris)</div> <div class="def">Function CXML:MAKE-CATALOG (&amp;optional uris)</div>
Return a catalog object for the catalog files specified. Return a catalog object for the catalog files specified.
</p> </p>
<p> <p>
@ -579,9 +557,9 @@ NIL</pre>
<h2>SAX Interface</h2> <h2>SAX Interface</h2>
<p> <p>
A SAX handler is an arbitrary objects that implements some of the A SAX handler is an arbitrary objects that implements some of the
generic functions in the SAX package.&nbsp; Note that no default generic functions in the SAX package.&#160; Note that no default
handler class is necessary, because all generic functions have default handler class is necessary, because all generic functions have default
methods which do nothing.&nbsp; SAX functions are: methods which do nothing.&#160; SAX functions are:
<div class="def">Function SAX:START-DOCUMENT (handler)</div> <div class="def">Function SAX:START-DOCUMENT (handler)</div>
<div class="def">Function SAX:END-DOCUMENT (handler)</div> <div class="def">Function SAX:END-DOCUMENT (handler)</div>
<br/> <br/>
@ -631,5 +609,4 @@ NIL</pre>
<p> <p>
<i>fixme</i>: For more information on these functions refer to the docstrings. <i>fixme</i>: For more information on these functions refer to the docstrings.
</p> </p>
</body> </documentation>
</html>

View File

@ -1,62 +1,4 @@
<?xml version="1.0" encoding="iso-8859-1"?> <documentation title="CXML XMLS Compatibility">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Closure XML</title>
<link rel="stylesheet" type="text/css" href="cxml.css"/>
</head>
<body>
<div class="sidebar">
<div class="sidebar-title">
<a href="README.html">Closure XML</a>
</div>
<div class="sidebar-main">
<ul class="main">
<li>
<a href="installation.html">Installing Closure XML</a>
<ul class="sub">
<li><a href="installation.html#download"><b>Download</b></a></li>
<li><a href="installation.html#implementations">Implementation-specific notes</a></li>
<li><a href="installation.html#compilation">Compilation</a></li>
<li><a href="installation.html#tests">Tests</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li>
<a href="quickstart.html"><b>Quick-Start Example</b></a>
</li>
</ul>
</li>
<li>
<a href="using.html">SAX parser</a>
<ul class="sub">
<li><a href="using.html#parser">Parsing and Validating</a></li>
<li><a href="using.html#serialization">Serialization</a></li>
<li><a href="using.html#misc">Miscellaneous SAX handlers</a></li>
<li><a href="using.html#rods">Recoders</a></li>
<li><a href="using.html#dtdcache">Caching of DTD Objects</a></li>
<li><a href="using.html#catalogs">XML Catalogs</a></li>
<li><a href="using.html#sax">SAX Interface</a></li>
</ul>
</li>
<li>
<a href="dom.html">DOM implementation</a>
<ul class="sub">
<li><a href="dom.html#parser">Parsing with the DOM builder</a></li>
<li><a href="dom.html#serialization">Serialization</a></li>
<li><a href="dom.html#mapping">DOM/Lisp mapping</a></li>
</ul>
</li>
<li>
<ul class="hack">
<li><a href="xmls-compat.html">XMLS Builder</a></li>
</ul>
</li>
</ul>
</div>
</div>
<h1>XMLS Builder</h1> <h1>XMLS Builder</h1>
<p> <p>
Like other XML parsers written in Lisp, CXML can work with Like other XML parsers written in Lisp, CXML can work with
@ -74,8 +16,8 @@
DOM functions cannot be implemented on them. DOM functions cannot be implemented on them.
</p> </p>
<p> <p>
<div class="def">Function CXML-XMLS:MAKE-XMLS-BUILDER (&key include-default-values)</div> <div class="def">Function CXML-XMLS:MAKE-XMLS-BUILDER (&amp;key include-default-values)</div>
Create a SAX handler which builds XMLS list structures.&nbsp; Create a SAX handler which builds XMLS list structures.&#160;
If <tt>include-default-values</tt> is true, default values for If <tt>include-default-values</tt> is true, default values for
attributes declared in a DTD are included as attributes in the attributes declared in a DTD are included as attributes in the
xmls output. <tt>include-default-values</tt> is true by default xmls output. <tt>include-default-values</tt> is true by default
@ -87,7 +29,7 @@
</p> </p>
<pre>(cxml:parse-file "test.xml" (cxml-xmls:make-xmls-builder))</pre> <pre>(cxml:parse-file "test.xml" (cxml-xmls:make-xmls-builder))</pre>
<p> <p>
<div class="def">Function CXML-XMLS:MAP-NODE (handler node &key include-xmlns-attributes)</div> <div class="def">Function CXML-XMLS:MAP-NODE (handler node &amp;key include-xmlns-attributes)</div>
Traverse an XMLS document/node and call SAX functions as if an XML Traverse an XMLS document/node and call SAX functions as if an XML
representation of the document were processed by a SAX parser. representation of the document were processed by a SAX parser.
</p> </p>
@ -95,15 +37,15 @@
Use this function to serialize XMLS data. For example, we could Use this function to serialize XMLS data. For example, we could
define a replacement for <tt>xmls:write-xml</tt> like this: define a replacement for <tt>xmls:write-xml</tt> like this:
</p> </p>
<pre>(defun write-xml (stream node &key indent) <pre>(defun write-xml (stream node &amp;key indent)
(let ((sink (cxml:make-character-stream-sink (let ((sink (cxml:make-character-stream-sink
stream :canonical nil :indentation indent))) stream :canonical nil :indentation indent)))
(cxml-xmls:map-node sink node)))</pre> (cxml-xmls:map-node sink node)))</pre>
<p> <p>
<div class="def">Function CXML-XMLS:MAKE-NODE (&key name ns attrs <div class="def">Function CXML-XMLS:MAKE-NODE (&amp;key name ns attrs
children) => xmls node</div> children) => xmls node</div>
Build a list node of the form Build a list node of the form
(<em>name</em>&nbsp;((<em>name</em>&nbsp;<em>value</em>)<em>*</em>)&nbsp;<em>child*</em>). (<em>name</em>&#160;((<em>name</em>&#160;<em>value</em>)<em>*</em>)&#160;<em>child*</em>).
</p> </p>
<p> <p>
The node list's <tt>car</tt> can also be a cons of local <tt>name</tt> The node list's <tt>car</tt> can also be a cons of local <tt>name</tt>
@ -129,5 +71,4 @@
</p> </p>
<p> <p>
</p> </p>
</body> </documentation>
</html>