1 <documentation title="CXML SAX parser">
2 <h1>SAX parsing and serialization</h1>
7 This chapter describes CXML's SAX-like parser interface.
10 The SAX layer is an important concept in CXML that users will
11 encounter in various situations:
15 To <b>parse into DOM</b>, use the SAX parser as described below with
16 a <b>DOM builder</b> as the SAX handler. (Refer to <a
17 href="dom.html#parser">make-dom-builder</a> for information about
21 <b>Serialization</b> is done using SAX, too. SAX handlers that
22 process and consume events without sending them to another
23 handler are called <i>sinks</i> in CXML. Serialization sinks
24 write XML output for the events they receive. For example, to
25 serialize DOM, use <tt>map-document</tt> to turn the DOM
26 document into SAX events together with a <tt>sink</tt> for
30 SAX handlers can be chained together. Various SAX handlers
31 are offered that can be used in this way, transforming SAX
32 events before handing them to the next handler. This includes
33 handlers for <b>whitespace removal</b>, <b>namespace
34 normalization</b>, and rod-to-string <b>recoding</b>.
38 However, SAX events are easier to generate than to process. That
39 is why CXML offers <i>Klacks</i>, a "pull-based" API in addition to SAX.
40 Klacks events are generally easier to process than to generate.
41 Please refer to the <a href="klacks.html">Klacks documentation</a>
45 <h3>Parsing and Validating</h3>
46 <div style="border: 1px dotted black;
50 Old-style convenience functions:
52 <div style="font-weight: bold">Function CXML:PARSE-FILE (pathname handler &key ...)</div>
53 <p style="margin-left: 2em">Same as <tt>cxml:parse</tt> with a pathname argument.
54 (But note that <tt>cxml:parse-file</tt> interprets string
55 arguments as namestrings, while <tt>cxml:parse</tt> expects
56 literal XML documents.)
58 <div style="font-weight: bold">Function CXML:PARSE-STREAM (stream handler &key ...)</div>
59 <p style="margin-left: 2em">Same as <tt>cxml:parse</tt> with a stream argument.</p>
60 <div style="font-weight: bold">Function CXML:PARSE-OCTETS (octets handler &key ...)</div>
61 <p style="margin-left: 2em">Same as <tt>cxml:parse</tt> with an octet vector argument.</p>
62 <div style="font-weight: bold">Function CXML:PARSE-ROD (rod handler &key ...)</div>
63 <p style="margin-left: 2em">Same as <tt>cxml:parse</tt> with a string argument.</p>
67 New all-in-one parser interface:
69 <div class="def">Function CXML:PARSE (input handler &key ...)</div>
71 Parse an XML document, where input is a string, pathname, octet
73 Return values from this function depend on the SAX handler used.<br/>
78 <tt>input</tt> -- one of:<br/>
81 <tt>pathname</tt> -- a Common Lisp pathname.
82 Open the file specified by the pathname and parse its
83 contents as an XML document.
85 <li><tt>stream</tt> -- a Common Lisp stream with element-type
86 <tt>(unsigned-byte 8)</tt>.
89 <tt>octets</tt> -- an <tt>(unsigned-byte 8)</tt> array.
90 The array is parsed directly, and interpreted according to the
91 encoding it specifies.
94 <tt>string</tt>/<tt>rod</tt> -- a rod (or <tt>string</tt> on
95 unicode-capable implementations).
96 Parses an XML document from the input string that has already
97 undergone external-format decoding.
101 <li><tt>stream</tt> -- a Common Lisp stream with element-type
102 <tt>(unsigned-byte 8)</tt></li>
103 <li><tt>octets</tt> -- an <tt>(unsigned-byte 8)</tt> array</li>
104 <li><tt>handler</tt> -- a SAX handler</li>
107 Common keyword arguments:
111 <tt>validate</tt> -- A boolean.  Defaults to
112 <tt>nil</tt>. If true, parse in validating mode, i.e. assert that
113 the document contains a DOCTYPE declaration and conforms to the
117 <tt>dtd</tt> -- unless <tt>nil</tt>, an extid instance
118 specifying the external subset to load. This options overrides
119 the extid specified in the document type declaration, if any.
120 See below for <tt>make-extid</tt>. This option is useful
121 for verification purposes together with the <tt>root</tt>
122 and <tt>disallow-internal-subset</tt> arguments.
124 <li><tt>root</tt> -- the expected root element
125 name, or <tt>nil</tt> (the default).
128 <tt>entity-resolver</tt> -- <tt>nil</tt> or a function of two
129 arguments which is invoked for every entity referenced by the
130 document with the entity's Public ID (a rod) and System ID (an
131 URI object) as arguments. The function may either return
132 nil, CXML will then try to resolve the entity as usual.
133 Alternatively it may return a Common Lisp stream specialized on
134 <tt>(unsigned-byte 8)</tt> which will be used instead. (It may
135 also signal an error, of course, which can be useful to prohibit
136 parsed XML documents from including arbitrary files readable by
140 <tt>disallow-internal-subset</tt> -- a boolean. If true, signal
141 an error if the document contains an internal subset.
144 <tt>recode</tt> -- a boolean. (Ignored on Lisps with Unicode
145 support.) Recode rods to UTF-8 strings. Defaults to true.
146 Make sure to use <tt>utf8-dom:make-dom-builder</tt> if this
147 option is enabled and <tt>rune-dom:make-dom-builder</tt>
152 Note: <tt>parse-rod</tt> assumes that the input has already been
153 decoded into Unicode runes and ignores the encoding
154 specified in the XML declaration, if any.
158 <div class="def">Function CXML:PARSE-EMPTY-DOCUMENT (uri qname handler &key public-id system-id entity-resolver recode)</div>
161 Simulate parsing a document with a document element <tt>qname</tt>
162 having no attributes except for an optional namespace
163 declaration to <tt>uri</tt>. If an external ID is specified
164 (<tt>system-id</tt>, <tt>public-id</tt>), find, parse, and report
165 this DTD as if with <tt>parse-file</tt>, using the specified
170 <div class="def">Function CXML:PARSE-DTD-FILE (pathname)</div>
171 <div class="def">Function CXML:PARSE-DTD-STREAM (stream)</div>
173 href="http://www.w3.org/TR/2000/REC-xml-20001006#NT-extSubset">declarations</a>
174 from a stand-alone file and return an object representing the DTD,
175 suitable as an argument to <tt>validate</tt>.
178 <li><tt>pathname</tt> -- a Common Lisp pathname</li>
179 <li><tt>stream</tt> -- a Common Lisp stream with element-type
180 <tt>(unsigned-byte 8)</tt></li>
184 <div class="def">Function CXML:MAKE-EXTID (publicid systemid)</div>
185 Create an object representing the External ID composed
186 of the specified Public ID, a rod or <tt>nil</tt>, and System ID
191 <div class="def">Condition class CXML:XML-PARSE-ERROR ()</div>
192 Superclass of all conditions signalled by the CXML parser.
195 <div class="def">Condition class CXML:WELL-FORMEDNESS-VIOLATION (cxml:xml-parse-error)</div>
196 This condition is signalled for all well-formedness violations.
197 (Note that, when parsing document that is not well-formed in validating
198 mode, the parser might encounter validity errors before detecting
199 well-formedness problems, so also be prepared for <tt>validity-error</tt>
203 <div class="def">Condition class CXML:VALIDITY-ERROR (cxml:xml-parse-error)</div>
204 Reports the violation of a validity constraint.
207 <a name="serialization"/>
208 <h3>Serialization</h3>
210 Serialization is performed using <tt>sink</tt> objects. There are
211 different kinds of sinks for output to lisp streams and vectors in
215 Technically, sinks are SAX handlers that write XML output for SAX
216 events sent to them. In practise, user code would normally not
217 generate those SAX events manually, and instead use a function
218 like <a href="dom.html#serialization">dom:map-document</a> or <a
219 href="xmls-compat.html">xmls-compat:map-node</a> to serialize an
223 In addition to <tt>map-document</tt>, cxml has a set of
224 convenience macros for serialization (see below for
225 <tt>with-xml-output</tt>, <tt>with-element</tt>, etc).
228 <div style="background-color: #ddddff">
230 <span class="def">Function CXML:MAKE-OCTET-VECTOR-SINK (&rest keys) => sink</span><br/>
231 <span class="def">Function CXML:MAKE-OCTET-STREAM-SINK (stream &rest keys) => sink</span><br/>
232 <span class="def">Function CXML:MAKE-ROD-SINK (&rest keys) => sink</span><br/>
234 Only on Lisps with Unicode support:<br/>
235 <span class="def">Function CXML:MAKE-STRING-SINK</span> -- alias for <tt>cxml:make-rod-sink</tt><br/>
236 <span class="def">Function CXML:MAKE-CHARACTER-STREAM-SINK (stream &rest keys) => sink</span><br/>
238 Only on Lisps <em>without</em> Unicode support:<br/>
239 <span class="def">Function CXML:MAKE-STRING-SINK/UTF8 (&rest keys) => sink</span><br/>
240 <span class="def">Function CXML:MAKE-CHARACTER-STREAM-SINK/UTF8 (stream &rest keys) => sink</span><br/>
243 Return a SAX serialization handle.
247 The <tt>-octet-</tt> functions write the document encoded into
249 <tt>make-octet-stream-sink</tt> works with Lisp streams of
250 element-type <tt>(unsigned-byte 8)</tt>.
251 <tt>make-octet-vector-sink</tt> returns a vector of
252 <tt>(unsigned-byte 8)</tt>.
255 <tt>make-character-stream-sink</tt> works with character
256 streams. It serializes the document into characters <em>without
257 encoding it into an external format</em>. When using these
258 functions, <em>take care to avoid encoding the result into
259 an incorrect external format</em>. (Note that characters undergo
260 external format conversion when written to a character stream.
261 If the document's XML declaration specifies an encoding, make
262 sure to specify this encoding as the external format if and when
263 writing the serialized document to a character stream. If the
264 document does not specify an encoding, either UTF-8 or UTF-16
265 must be used.) This function is available only on Lisps with
269 <tt>make-rod-sink</tt> serializes the document into a vector of
270 runes <em>without encoding it into an external format</em>.
271 (On Lisp with unicode support, the result will be a string;
272 otherwise, a vector of character codes will be returned.)
273 The warnings given for <tt>make-character-stream-sink</tt>
274 apply to this function as well.
277 The <tt>/utf8</tt> functions write the document encoded into
278 characters representing a UTF-8 encoding.
279 When using these functions, <em>take care to avoid encoding the
280 result</em> into an external format for a second time. (Note
281 that characters undergo external format conversion when written
282 to a character stream. Since these functions already perform
283 external format conversion, make sure to specify an external
284 format that does "nothing" if and when writing the serialized document
285 to a character stream. ISO-8859-1 external formats usually
286 achieve the desired effect.)
287 <tt>make-character-stream-sink/utf8</tt> works with character streams.
288 <tt>make-string-sink/utf8</tt> returns a string.
289 These functions are available only on Lisps without unicode support.
292 <p>Keyword arguments:</p>
295 <tt>canonical</tt> -- canonical form, one of NIL, T, 1, 2
298 <tt>indentation</tt> -- indentation level. An integer or <tt>nil</tt>.
301 <tt>encoding</tt> -- the character encoding to use. A string or
302 keyword. <tt>nil</tt> is also allowed and means UTF-8.
305 <tt>omit-xml-declaration-p</tt> -- Boolean. Don't write an XML
310 The following <tt>canonical</tt> values are allowed:
314 <tt>t</tt> or <tt>1</tt>: <a
315 href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">Canonical
320 href="http://dev.w3.org/cvsweb/~checkout~/2001/XML-Test-Suite/xmlconf/sun/cxml.html?content-type=text/html;%20charset=iso-8859-1">Second
324 <tt>NIL</tt>: Use a more readable non-canonical representation.
328 An internal subset will be included in the result regardless of
329 the <tt>canonical</tt> setting. It is the responsibility of the
330 caller to not report an internal subset for
331 canonical <= 1, or only notations as required for
332 canonical = 2. For example, the
333 <tt>include-doctype</tt> argument to <tt>dom:map-document</tt>
334 should be set to <tt>nil</tt> for the former behaviour and
335 <tt>:canonical-notations</tt> for the latter.
338 With an <tt>indentation</tt> level, pretty-print the XML by
339 inserting additional whitespace.  Note that indentation
340 changes the document model and should only be used if whitespace
341 does not matter to the application.
345 <div class="def">Macro CXML:WITH-XML-OUTPUT (sink &body body) => sink-specific result</div>
346 <div class="def">Macro CXML:WITH-NAMESPACE ((prefix uri) &body body) => result</div>
347 <div class="def">Macro CXML:WITH-ELEMENT (qname &body body) => result</div>
348 <div class="def">Macro CXML:WITH-ELEMENT* ((prefix lname) &body body) => result</div>
349 <div class="def">Function CXML:ATTRIBUTE (qname value) => value</div>
350 <div class="def">Generic Function CXML:UNPARSE-ATTRIBUTE (value) => string</div>
351 <div class="def">Function CXML:ATTRIBUTE* (prefix lname value) => value</div>
352 <div class="def">Function CXML:TEXT (data) => data</div>
353 <div class="def">Function CXML:CDATA (data) => data</div>
354 <div class="def">Function CXML:doctype (name public-id system-id &optional internal-subset)</div>
355 Convenience syntax for event-based serialization.
360 <pre>(with-xml-output (make-octet-stream-sink stream :indentation 2 :canonical nil)
362 (attribute "xyz" "abc")
364 (attribute "blub" "bla"))
365 (text "Hi there.")))</pre>
367 Prints this to <tt>stream</tt>:
369 <pre><foo xyz="abc">
370 <bar blub="bla"></bar>
375 <div class="def">Macro XHTML-GENERATOR:WITH-XHTML (sink &rest forms)</div>
376 <div class="def">Macro XHTML-GENERATOR:WRITE-DOCTYPE (sink)</div>
377 Macro <tt>with-xhtml</tt> is a modified version of
378 Franz' <tt>htmlgen</tt> works as a SAX driver for XHTML.
379 It aims to be a plug-in replacement for the <tt>html</tt> macro.
382 <tt>xhtmlgen</tt> is included as <tt>contrib/xhtmlgen.lisp</tt> in
383 the cxml distribution. Example:
385 <pre>(let ((sink (cxml:make-character-stream-sink *standard-output*)))
386 (sax:start-document sink)
387 (xhtml-generator:write-doctype sink)
388 (xhtml-generator:with-html sink
393 ((:p "style" "font-weight: bold")
399 (sax:end-document sink))</pre>
402 <h3>Miscellaneous SAX handlers</h3>
404 <div class="def">Function CXML:MAKE-VALIDATOR (dtd root)</div>
405 Create a SAX handler which validates against a DTD instance. 
406 The document's root element must be named <tt>root</tt>. 
407 Used with <tt>dom:map-document</tt>, this validates a document
408 object as if by re-reading it with a validating parser, except
409 that declarations recorded in the document instance are completely
413 <pre>(let ((d (parse-file "~/test.xml" (cxml-dom:make-dom-builder)))
414 (x (parse-dtd-file "~/test.dtd")))
415 (dom:map-document (cxml:make-validator x #"foo") d))</pre>
418 <div class="def">Class CXML:BROADCAST-HANDLER ()</div>
419 <div class="def">Accessor CXML:BROADCAST-HANDLER-HANDLERS</div>
420 <div class="def">Function CXML:MAKE-BROADCAST-HANDLER (&rest handlers)</div>
421 <tt>broadcast-handler</tt> is a SAX handler which passes every event it
422 receives on to each of several chained handlers, somewhat similar
423 to the way a <tt>broadcast-stream</tt> works.
426 You can subclass <tt>broadcast-stream</tt> to modify the events
427 before they are being passed on. Define methods on your handler
428 class for the events to be modified. All other events will pass
429 through to the chained handlers unmodified.
432 Broadcast handler functions return the result of calling the event
433 function on the <i>last</i> handler in the list. In particular,
434 the overall result from <tt>sax:end-document</tt> will be ignored
435 for all other handlers.
439 <div class="def">Class CXML:SAX-PROXY (broadcast-handler)</div>
440 <div class="def">Accessor CXML:PROXY-CHAINED-HANDLER</div>
441 <tt>sax-proxy</tt> is a subclass of <tt>broadcast-handler</tt>
442 which sends events to exactly one chained handler. This class is
443 still included for compatibility with older versions of
444 CXML which did not include the more
445 general <tt>broadcast-handler</tt> yet, but has been retrofitted
446 as a subclass of the latter.
450 <div class="def">Accessor CXML:MAKE-NAMESPACE-NORMALIZER (next-handler)</div>
453 Return a SAX handler that performs <a
454 href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algorithms.html#normalizeDocumentAlgo">DOM
455 3-style namespace normalization</a> on attribute lists in
456 <tt>start-element</tt> events before passing them on the next
460 <div class="def">Function CXML:MAKE-WHITESPACE-NORMALIZER (chained-handler &optional dtd)</div>
461 Return a SAX handler which removes whitespace from elements that
462 have <em>element content</em> and have not been declared to
463 preserve space using an xml:space attribute.
466 <pre>(cxml:parse-file "example.xml"
467 (cxml:make-whitespace-normalizer (cxml-dom:make-dom-builder))
469 <p>Example input:</p>
470 <pre><!DOCTYPE test [
471 <!ELEMENT test (foo,bar*)>
472 <!ATTLIST test a CDATA #IMPLIED>
473 <!ELEMENT foo #PCDATA>
474 <!ELEMENT bar (foo?)>
475 <!ATTLIST bar xml:space (default|preserve) "default">
480 <bar xml:space="preserve"> </bar>
483 <p>Example result:</p>
484 <pre><test a="b"><foo> </foo><bar></bar><bar xml:space="preserve"> </bar></test></pre>
489 Recoders are a mechanism used by CXML internally on Lisp implementations
490 without Unicode support to recode UTF-16 vectors (rods) of
491 integers (runes) into UTF-8 strings.
494 User code does not usually need to deal with recoders in current
498 <div class="def">Function CXML:MAKE-RECODER (chained-handler recoder-fn)</div>
499 Return a SAX handler which passes all events on to
500 <tt>chained-handler</tt> after converting all strings and rods
501 using <tt>recoder-fn</tt>, a function of one argument.
505 <h3>Caching of DTD Objects</h3>
507 To avoid spending time parsing the same DTD over and over again,
508 CXML can cache DTD objects. The parser consults
509 <tt>cxml:*dtd-cache*</tt> whenever it is looking for an external
510 subset in a document which does not have an internal subset and
511 uses the cached DTD instance if one is present in the cache for
512 the System ID in question.
515 Note that DTDs do not expire from the cache automatically.
516 (Future versions of CXML might introduce automatic checks for
520 <div class="def">Variable CXML:*DTD-CACHE*</div>
521 The DTD cache object consulted by the parser when it needs a DTD.
524 <div class="def">Function CXML:MAKE-DTD-CACHE ()</div>
525 Return a new, empty DTD cache object.
528 <div class="def">Variable CXML:*CACHE-ALL-DTDS*</div>
529 If true, instructs the parser to enter all DTDs that could have
530 been cached into <tt>*dtd-cache*</tt> if they were not cached
531 already. Defaults to <tt>nil</tt>.
534 <div class="def">Reader CXML:GETDTD (uri dtd-cache)</div>
535 Return a cached instance of the DTD at <tt>uri</tt>, if present in
536 the cache, or <tt>nil</tt>.
539 <div class="def">Writer CXML:GETDTD (uri dtd-cache)</div>
540 Enter a new value for <tt>uri</tt> into <tt>dtd-cache</tt>.
543 <div class="def">Function CXML:REMDTD (uri dtd-cache)</div>
544 Ensure that no DTD is recorded for <tt>uri</tt> in the cache and
545 return true if such a DTD was present.
548 <div class="def">Function CXML:CLEAR-DTD-CACHE (dtd-cache)</div>
549 Remove all entries from <tt>dtd-cache</tt>.
552 <em>fixme:</em> thread-safety
555 <a name="saxparser"/>
556 <h3>Location information</h3>
558 <div class="def">Class SAX:SAX-PARSER ()</div>
559 A class providing location information through an
560 implementation-specific subclass. Parsers will use
561 <tt>sax:register-sax-parser</tt> to pass their parser instance to
562 the handler. The easiest way to receive sax parsers instances is
563 to inherit from sax-parser-mixin when defining a sax handler.
566 <div class="def">Class SAX:SAX-PARSER-MIXIN ()</div>
567 A mixin for sax handler classes that records the sax handler
568 object for use with the following functions. Trampoline methods
569 are provided that allow those functions to be called directly on
570 the sax-parser-mixin.
573 <div class="def">Function SAX:SAX-HANDLER (sax-handler-mixin) => sax-handler</div>
574 Return the sax-parser instance recorded by this handler, or NIL.
577 <div class="def">Function SAX:LINE-NUMBER (sax-parser)</div>
578 Return an approximation of the current line number, or NIL.
581 <div class="def">Function SAX:COLUMN-NUMBER (sax-parser)</div>
582 Return an approximation of the current column number, or NIL.
585 <div class="def">Function SAX:SYSTEM-ID (sax-parser)</div>
586 Return the URI of the document being parsed. This is either the
587 main document, or the entity's system ID while contents of a parsed
588 general external entity are being processed.
591 <div class="def">Function SAX:XML-BASE (sax-parser)</div>
592 Return the [Base URI] of the current element. This URI can differ from
593 the value returned by <tt>sax:system-id</tt> if xml:base
594 attributes are present.
598 <h3>XML Catalogs</h3>
600 External entities (for example, DTDs) are referred to using their
601 Public and System IDs. Usually the System ID, a URI, is used to
602 locate the entity. CXML itself handles only file://-URIs, but
603 many System IDs in practical use are http://-URIs. There are two
604 different mechanims applications can use to allow CXML to locate
605 entities using arbitrary Public ID or System ID:
609 User-defined entity resolvers can be used to open entities using
610 arbitrary protocols. For example, an entity resolver could
611 handle all System-IDs with the <tt>http</tt> scheme using some
612 HTTP library. Refer to the description of the
613 <tt>entity-resolver</tt> keyword argument to parser functions (see <a
614 href="#parser"><tt>cxml:parse-file</tt></a>) to more
615 information on entity resolvers.
618 XML Catalogs are (local) tables in XML syntax which map External
619 IDs to alternative System IDs. If, say, the xhtml DTD is
620 present in the local file system and the local copy has been
621 registered with the XML catalog, CXML will use the local copy of
622 the DTD instead of trying to open the version available using HTTP.
626 This section describes XML Catalogs, the second solution. CXML
628 href="http://www.oasis-open.org/committees/entity/spec.html">Oasis
632 <div class="def">Variable CXML:*CATALOG*</div>
633 The XML Catalog object consulted by the parser before trying to
634 open an entity. Initially <tt>nil</tt>.
637 <div class="def">Variable CXML:*PREFER*</div>
638 The default "prefer" mode from the Catalog specification, one
639 of <tt>:public</tt> or <tt>:system</tt>. Defaults
643 <div class="def">Function CXML:MAKE-CATALOG (&optional uris)</div>
644 Return a catalog object for the catalog files specified.
647 <div class="def">Function CXML:RESOLVE-URI (uri catalog)</div>
648 Look up <tt>uri</tt> in <tt>catalog</tt> and return the
649 resulting URI, or <tt>nil</tt> if no match was found.
652 <div class="def">Function CXML:RESOLVE-EXTID (publicid systemid catalog)</div>
653 Look up the External ID (<tt>publicid</tt>, <tt>systemid</tt>)
654 in <tt>catalog</tt> and return the resulting URI, or <tt>nil</tt>
655 if no match was found.
660 <pre>* (setf cxml:*catalog* nil)
661 * (cxml:parse-file "test.xhtml" nil)
662 => Error: URI scheme :HTTP not supported
664 * (setf cxml:*catalog* (cxml:make-catalog))
665 * (cxml:parse-file "test.xhtml" nil)
669 Note that parsed catalog files are cached in the catalog object.
670 Catalog files cached do not expire automatically. To ensure that
671 all catalog files are parsed again, create a new catalog object.
675 <h2>SAX Interface</h2>
677 A SAX handler is an arbitrary objects that implements some of the
678 generic functions in the SAX package.  Note that no default
679 handler class is necessary, because all generic functions have default
680 methods which do nothing.  SAX functions are:
681 <div class="def">Function SAX:START-DOCUMENT (handler)</div>
682 <div class="def">Function SAX:END-DOCUMENT (handler)</div>
684 <div class="def">Function SAX:START-ELEMENT (handler namespace-uri local-name qname attributes)</div>
685 <div class="def">Function SAX:END-ELEMENT (handler namespace-uri local-name qname)</div>
686 <div class="def">Function SAX:START-PREFIX-MAPPING (handler prefix uri)</div>
687 <div class="def">Function SAX:END-PREFIX-MAPPING (handler prefix)</div>
688 <div class="def">Function SAX:PROCESSING-INSTRUCTION (handler target data)</div>
689 <div class="def">Function SAX:COMMENT (handler data)</div>
690 <div class="def">Function SAX:START-CDATA (handler)</div>
691 <div class="def">Function SAX:END-CDATA (handler)</div>
692 <div class="def">Function SAX:CHARACTERS (handler data)</div>
694 <div class="def">Function SAX:START-DTD (handler name public-id system-id)</div>
695 <div class="def">Function SAX:END-DTD (handler)</div>
696 <div class="def">Function SAX:START-INTERNAL-SUBSET (handler)</div>
697 <div class="def">Function SAX:END-INTERNAL-SUBSET (handler)</div>
698 <div class="def">Function SAX:UNPARSED-ENTITY-DECLARATION (handler name public-id system-id notation-name)</div>
699 <div class="def">Function SAX:EXTERNAL-ENTITY-DECLARATION (handler kind name public-id system-id)</div>
700 <div class="def">Function SAX:INTERNAL-ENTITY-DECLARATION (handler kind name value)</div>
701 <div class="def">Function SAX:NOTATION-DECLARATION (handler name public-id system-id)</div>
702 <div class="def">Function SAX:ELEMENT-DECLARATION (handler name model)</div>
703 <div class="def">Function SAX:ATTRIBUTE-DECLARATION (handler ename aname type default)</div>
705 <div class="def">Accessor SAX:ATTRIBUTE-PREFIX (attribute)</div>
706 <div class="def">Accessor SAX:ATTRIBUTE-NAMESPACE-URI (attribute)</div>
707 <div class="def">Accessor SAX:ATTRIBUTE-LOCAL-NAME (attribute)</div>
708 <div class="def">Accessor SAX:ATTRIBUTE-QNAME (attribute)</div>
709 <div class="def">Accessor SAX:ATTRIBUTE-SPECIFIED-P (attribute)</div>
710 <div class="def">Accessor SAX:ATTRIBUTE-VALUE (attribute)</div>
712 <div class="def">Function SAX:FIND-ATTRIBUTE (qname attributes)</div>
713 <div class="def">Function SAX:FIND-ATTRIBUTE-NS (uri lname attributes)</div>
716 The entity declaration methods are similar to Java SAX
717 definitions, but parameter entities are distinguished from
718 general entities not by a <tt>%</tt> prefix to the name, but by
719 the <tt>kind</tt> argument, either <tt>:parameter</tt> or
723 The arguments to <tt>sax:element-declaration</tt> and
724 <tt>sax:attribute-declaration</tt> differ significantly from their
728 <i>fixme</i>: For more information on these functions refer to the docstrings.