2 <API id='Sablotron Guide and'>
5 &copy; 2002 Ginger Alliance<BR/>
6 <I>revision 02-11-04</I><BR/>
11 <ENTRY id='.Introduction'>
12 <TYPE value='.General'/>
14 Sablotron is an XML processor implementing XPath 1.0, XSLT 1.0 and
15 DOM Level2. It also includes some other features such as XSLT debugger,
16 SXP (access to external documents via callbacks) or EXSLT support.
19 Sablotron is a single shared library written in C++ (sablot.dll
20 or libsablot.so.x.xx). It provides a native C API; APIs for Perl, PHP,
21 Python, Ruby and other languages are available through wrappers (not
22 part of the Sablotron project). See <S>gingerall.org</S> for more
23 information on Sablotron wrappers. Sablotron can also be used from the
24 command line via a simple interface called <C>sabcmd</C>.<P/>
26 Sablotron implements the following W3C recommendations:
27 <S>XPath 1.0</S>, <S>XSLT 1.0</S> and <S>DOM Level2</S>. See
28 <C>.Known Issues</C> for details on deviations from the specs.
29 Go to <C>.Sablotron DOM</C> for more information on Sablotron DOM
32 Sablotron also include an XPath Processor (SXP) working with virtual DOM
33 objects accessed via user-defined (DOM-like) callback functions. The C
34 API to SXP is described in a separate <S>SXP Reference</S> guide.
36 A relevant subset of EXSLT extensions is supported by Sablotron. See
37 <C>.Extensions</C> for details.
39 Third-party libraries Sablotron depends on and libraries that can be
40 linked by Sablotron optionally are listed in <C>.Dependencies</C>.
42 The latest Sablotron sources can be downloaded from <S>gingerall.org</S>.
43 For instructions on how to build the sources, refer to the accompanying
44 INSTALL file. The <S>gingerall.org</S> site also includes links to other
45 documentation, FAQs, mailing lists, CVS, bugzilla, lxr and other
46 Sablotron-related resources. Sablotron is an open source project and
47 everyone is invited to join it.
49 <EXTERNALREF name="XPath 1.0" value="http://www.w3.org/TR/xpath"/>
50 <EXTERNALREF name="XSLT 1.0" value="http://www.w3.org/TR/xslt"/>
51 <EXTERNALREF name="DOM Level2" value="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/"/>
52 <EXTERNALREF name="SXP Reference" value="http://www.gingerall.org/ga/html/sxp/complete-frameset.html"/>
53 <EXTERNALREF name="gingerall.org" value="http://www.gingerall.org"/>
56 <ENTRY id='.Extensions'>
57 <TYPE value='.General'/>
59 Sablotron supports a number of EXSLT extensions.
62 Sablotron recognizes the extension element
63 <B>funct:script</B> (xmlns:funct="http://exslt.org/functions")
64 to run ECMAScript (JavaScript) functions as suggested by
65 <S>EXSLT.org</S>. Extension functions have a read-only DOM access
66 to the main XML document and to
67 node-sets passed as arguments. The implementation follows the
68 ECMAScript/DOM2 Language Binding defined in <S>XSLT 1.1</S>,
69 Appendix C3, and <S>DOM Level2</S>, Appendix E. See Sablotron
70 <S>Extensions API Reference</S> guide to get more details on how to use
71 DOM methods from JS extension functions.
73 Sablotron also supports <B>exsl:document</B> element
74 (xmlns:exsl="http://exslt.org/common") to produce multiple output
77 In addition to the standard output methods (xml, html and text), it is
78 possible to output xhtml. Documents output using this method obey the
79 XHTML 1.0 rules (in particular, all empty elements are closed).
80 To choose the method, use <B>xsl:output method='xhtml'</B>.
82 <EXTERNALREF name="Extensions API Reference" value="http://www.gingerall.org/ga/html/jsdom-ref/complete-frameset.html"/>
83 <EXTERNALREF name="EXSLT.org" value="http://www.exslt.org"/>
84 <EXTERNALREF name="XSLT 1.1" value="http://www.w3.org/TR/xslt11/"/>
85 <EXTERNALREF name="DOM Level2" value="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/"/>
88 <ENTRY id='.Known Issues'>
89 <TYPE value='.General'/>
91 There are some known minor distinctions from W3C specifications.
95 * id() function not implemented.<BR/>
98 * embedded stylesheets don't work,<BR/>
99 * some illegal operations with RTFs are allowed,<BR/>
100 * case-order attribute of xsl:sort not supported.<BR/>
102 <B>DOM Level2</B><BR/>
103 * Document.docElementsByTagName not implemented,<BR/>
104 * Document.docElementsByTagNameNS not implemented,<BR/>
105 * node name lists may be accessed with the item() function only
106 not as array items,<BR/>
107 * NamedNodeMap.getNamedItemsNS not implemented.<BR/>
109 <B>Other issues:</B><BR/>
110 * the 'xhtml' output method is different from what is suggested
112 * all parameters must be passed in utf-8 encoded.<BR/>
114 <EXTERNALREF name="XPath 1.0" value="http://www.w3.org/TR/xpath"/>
115 <EXTERNALREF name="XSLT 1.0" value="http://www.w3.org/TR/xslt"/>
116 <EXTERNALREF name="DOM Level2" value="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/"/>
119 <ENTRY id='.License'>
120 <TYPE value='.General'/>
122 Sablotron licensing terms and Copyright
125 Sablotron is subject to the Mozilla Public License Version 1.1
126 (the <S>MPL</S>). Alternatively, Sablotron may be used under the
127 terms of the GNU General Public License Version 2 or later (the
128 <S>GPL</S>), in which case the provisions of the GPL are applicable
129 instead of those of the MPL.
131 The Sablotron project has been originated and is maintained
132 by Ginger Alliance. Portions created by Ginger Alliance are
133 Copyright Ginger Alliance s.r.o. Portions created by other
134 contributors are Copyright of these contributors.
135 All rights are reserved.
137 <EXTERNALREF name="MPL" value="http://www.mozilla.org/MPL/MPL-1.1.html"/>
138 <EXTERNALREF name="GPL" value="http://www.gnu.org/licenses/gpl.html"/>
142 <TYPE value='.General'/>
144 Examples of how to use the native API of Sablotron.
147 The first example shows the simplest way to run a transformation with
148 two files. The second example parses trees explicitly and makes them
149 available for further processing. In this example, the source XML document
150 and the XSLT stylesheet are already loaded in strings (my_xsl_ptr,
151 my_xml_ptr). To work with URIs, use <C>SablotParseStylesheet</C> and
152 <C>SablotParse</C> instead of <C>SablotParseStylesheetBuffer</C> and
153 <C>SablotParseBuffer</C>.
156 EXAMPLE 1: a simple transformation
161 SablotCreateSituation(&S);
162 SablotCreateProcessorForSituation(S, &proc);
164 SablotRunProcessorGen(S, proc, "my_sheet.xsl", "my_data.xml", "arg:/out");
167 SablotGetResultArg(proc, "arg:/out", &result);
172 SablotDestroyProcessor(proc);
173 SablotDestroySituation(S);
175 EXAMPLE 2: a transformation with reusable parsed trees
179 SDOM_Document xsl, xml;
181 SablotCreateSituation(&S);
182 SablotParseStylesheetBuffer(S, my_xsl_ptr, &xsl);
183 SablotParseBuffer(S, my_xml_ptr, &xml);
185 SablotCreateProcessorForSituation(S, &proc);
186 SablotAddArgTree(S, proc, "sheet", xsl);
187 SablotAddArgTree(S, proc, "data", xml);
189 SablotRunProcessorGen(S, proc, "arg:/sheet", "arg:/data", "arg:/out");
192 SablotGetResultArg(proc, "arg:/out", &result);
197 SablotDestroyDocument(xsl);
198 SablotDestroyDocument(xml);
199 SablotDestroyProcessor(proc);
200 SablotDestroySituation(S);
205 <TYPE value='.General'/>
207 sabcmd is a command line interface to Sablotron library.
210 sabcmd [options] &lt;stylesheet&gt; [&lt;input&gt; [&lt;output&gt;]] [assignments]
211 sabcmd [options] -batch-xml &lt;input&gt; [&lt;stylesheet&gt; [&lt;output&gt;]]+ [assignments]
212 sabcmd [options] -batch-xsl &lt;stylesheet&gt; [&lt;input&gt; [&lt;output&gt;]]+ [assignments]
215 <B>sabcmd</B> is a command line interface to Sablotron XSLT processor.
216 You can use is to transform XML files with XSLT stylesheets.
218 The only required parameter is a stylesheet; this is a URI of
219 an XSLT stylesheet to be used for the transformation process. If you
220 omit an input file, the standard input is used. In addition, you can
221 specify an output file. If no output file is given, the output is sent to
224 sabcmd can also run in a batch mode to process single input file with
225 multiple stylesheets (--batch-xml) or to apply a stylesheet to multiple
226 input files (--batch-xsl).
228 <B>Assignments</B> allow to pass parameters and named buffers to the
229 processor. The assignments have always the form of
230 <C>name1=value1 name2=value2 ...</C>
231 where name is either an ASCII string for named buffers or an ASCII string
232 with the leading '$' sign for parameters. (Note that you need to use the
233 right quotes to prevent the shell interpreter from performing an expansion
238 Option can be of two forms - short or long. If some options have
239 values, the values are separated with a whitespace for short options
240 and with a equal sign ('=') for long options.
241 <C>-L mylog.log</C> is the same as <C>--log-file=mylog.log</C>
243 <B>COMMON OPTIONS</B>
245 <C>-x, --batch-xml</C> - multiple stylesheets, single input file
247 <C>-s, --batch-xsl</C> - multiple input files, single stylesheet
249 <C>-b, --base=NAME</C> - set the hard base URI to NAME
251 <C>--debug-options</C> - display the information on debugging options
253 <C>-?, --help</C> - display this help message
255 <C>-L, --log-file=NAME</C> - set the log file, turns logging on
257 <C>-m, --measure</C> - measure the time of processing
259 <C>-v, --version</C> - display the version information
263 <C>--debug</C> - display results of the command line parse
265 <C>-t, --times=COUNT</C> - run sabcmd the specified number of times
267 <C>-f, --flags</C> - pass flags given to SablotSetOptions()
269 <C>-F, --use-SPF</C> - use SablotProcessFiles()
271 <C>-S, --use-SPS</C> - use SablotProcessStrings(). Give 2 args (stylesheet,
272 input). Precede each by @.
274 <C>--use-SPS-on-files</C> - use SablotProcessStrings() on the contents of
279 When the <B>xsl:sort</B> instruction is used without the 'lang' attribute,
280 common locale related environment variables apply..
284 <ENTRY id='.Debugging XSLT'>
285 <TYPE value='.General'/>
287 Sablotron can be used as XSLT debugger.
290 Run <C>'sabcmd --debugger'</C> to invoke the debugger. Then, you can trace
291 execution of your templates. The only point, where the debugger can stop
292 the execution is the element start.
296 These commands can be used from the debugger command line:
299 data filename - sets the data file
300 param name value - sets the external parameter
302 PP - clears all params
303 sheet filename - sets the stylesheet
305 break filename:line - sets the breakpoint
306 bstat - shows breakpoint stats (total/enabled/break)
307 B - lists all breakpoints
308 condition num cond - for the breakpoint NUM sets the condition COND
309 del num - deletes the breakpoint NUM
310 disable num - toggles the breakpoint number NUM
311 D - deletes all breakpoints
312 ignore num count - ignores the breakpoint NUM for COUNT times
314 continue - continues the execution
315 finish - finishes the current node parent
316 kill - stops the processing immediately
317 next - goes to the next sibling
318 run - runs the processor
319 step - continues until the next element
320 templ - continues until the next template executed
322 eval - evaluates the XPath expression
323 x [list | num] - examines the current context
325 batch filename - loads the command set for file
326 help - prints this help
327 output - toggles output on/off
328 point - shows where you are
329 quit - quites the debugger
332 <B>Abbreviations</B><BR/>
333 You need to type as few letters to specify the command as is
334 needed to recognize, what you mean. The most frequent command may
335 be run with single letter not caring, whether another command
336 starts with this letter. The `s' abbrev runs the `step' command
339 <B>Emacs Integration</B><BR/>
340 There is an Emacs library available. You may use it to debug
341 your stylesheets in Emacs directly. You need to grab the sabdbg.el
342 from the Sablotron source tree and to add a couple of lines into
343 your .emacs file. Look at doc/misc/DEBUGGER file in Sablotron
344 distribution for more details.
348 <ENTRY id='.Dependencies'>
349 <TYPE value='.General'/>
351 Third-party libraries that must be or can be linked to Sablotron.
354 <S>Expat</S> - an XML parser Sablotron depends on. This is the only
355 MANDATORY dependence. Sablotron looks for Expat during the
356 configuration. Expat is a standard part of many operating systems and
357 is available for all systems where Sablotron can run.
358 Expat is distributed under a MIT-styled license.
360 <S>Iconv</S> - a GNU encoding library you need if you want to use more
361 encodings/charsets than these supported by Sablotron internally.
362 See <C>.Encodings</C> for more details. Sablotron looks for Iconv
363 during the configuration but it still compiles when not found.
364 Iconv is a standard part of many operating systems and is available
365 for all systems where Sablotron can run. Iconv is released under terms
368 <S>JavaScript</S> - JS C (SpiderMonkey) engine by Mozilla is needed
369 to run XSLT extension function. See <C>.Extensions</C> for details.
370 Linking JavaScript is optional (./configure --enable-javascript).
371 JS engine is available for all systems where Sablotron can run.
372 Mozilla's C implementation of JavaScript is distributed under terms
375 <S>Readline</S> - a GNU library providing the XSLT debugger with
376 functions to easily work with the command line. You may want to
377 link Readline if you compile Sablotron with XSLT debugger
378 (./configure --enable-debugger --with-readline). Without Readline,
379 the debugger still works, but you can't use user-friendly features
380 such as the command-line history.
381 Readline is distributed under the GNU GPL license, thus you must
382 use Sablotron under GPL (this is one of two possible alternatives, see
383 <C>.License</C> for details) if you want to link Readline. Export
384 SABLOT_GPL=1 environment in order to express your decision.
386 <EXTERNALREF name="Expat" value="http://expat.sourceforge.net"/>
387 <EXTERNALREF name="Iconv" value="http://www.gnu.org/software/libiconv/"/>
388 <EXTERNALREF name="JavaScript" value="http://www.mozilla.org/js/"/>
389 <EXTERNALREF name="Readline" value="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html"/>
392 <!-- Implementation notes -->
393 <ENTRY id='.Handlers'>
394 <TYPE value='.Implementation Notes'/>
396 It is possible for the user to supply the following handlers to
400 <B>message handler</B> - to bypass the default way of displaying
401 error and warning messages and logging,<BR/>
402 <B>scheme handler</B> - to retrieve documents whose URI use an
403 unsupported scheme,<BR/>
404 <B>streaming handler</B> - an expat-like interface to the XML document
405 which is the result of the processing,<BR/>
406 <B>encoding handler</B> - to handle an unsupported encoding<BR/>
407 <B>'miscellaneous' handler</B> - which will probably serve as
408 a collections of odd callbacks.<P/>
410 The handlers are set using <C>SablotRegHandler</C>. For details
411 concerning the interface of these handlers, consult the header
412 files sablot.h and shandler.h.<P/>
417 <ENTRY id='.Encodings'>
418 <TYPE value='.Implementation Notes'/>
420 Sablotron supports a number of input/output encodings and charsets;
421 either internally or through the iconv library.
424 Sablotron handles encoding conversions with the help of iconv library.
425 As a standard part of glibc, iconv is automatically available on many
426 Unix-based systems (including Linux). It's available for most other
427 platforms where Sablotron runs (Windows, Solaris, MacOS X, FreeBSD, etc).
428 See <C>.Dependencies</C> for more details on iconv.
430 With iconv installed on your system, you can use any encoding it supports
431 (that is, almost any encoding whatsoever) for both the input and the output
434 If iconv is not available, encodings may still be supported internally
435 by Sablotron. At present, the list is of such encodings is rather short:
436 UTF-8, UTF-16, ASCII, iso-8859-1, iso-8859-2 and windows-1250 on input,
437 UTF-8 only on output.
439 Lastly, a user has the option to implement a custom encoding conversion
440 handler, which will be asked to perform any unsupported conversion. See
441 <C>.Handlers</C> for details.
443 The default input and output encoding is in all cases UTF-8.
448 <TYPE value='.Implementation Notes'/>
450 Sablotron can handle two URI schemes natively: 'file' and 'arg'.
453 Only two URI schemes are built-in: 'file' and 'arg' (see
454 <C>.Named buffers</C>). Moreover, it is possible to use the function
455 <C>SablotRegHandler</C> to register an external scheme handler which
456 will receive requests in all other schemes. See <C>.Handlers</C>
457 and sablot.h and shandler.h files for details.
459 Relative URI references are resolved in conformance to RFC 2396.
460 The base URI is well defined when the relative reference appears inside
461 a XML document; when invoking <C>sabcmd</C>, the base URI is taken to
462 correspond to the current working directory.
464 When specifying filenames, the following rules are in effect:<BR/>
465 * specify the "file:" scheme for any standard files, i.e. refer to
466 stdin as file://stdin etc.<BR/>
467 * slashes and backslashes work equally fine, in Windows as well as
469 * to include a drive letter under Windows (e.g. C:\doc.xml), it is
470 necessary to say file://c:/doc.xml.<BR/>
474 <ENTRY id='.Named buffers'>
475 <TYPE value='.Implementation Notes'/>
477 Sablotron can store XML strings and parsed trees to so called
481 Sablotron introduces an URI scheme 'arg:' which enables one to use
482 strings and parsed trees in named memory buffers. Named buffers are
483 can be set using <C>SablotAddArgBuffer</C> or <C>SablotAddArgTree</C>
484 functions. The content of buffers can be accessed with the
485 <C>document()</C> function or <C>xsl:include/import</C> instructions
486 (e.g. document('arg:/my_buffer')/root).
489 can have a tree-like structure so that a relative reference from a
490 document in a buffer can be resolved as pointing to another buffer.
492 For instance, if we invoke Sablotron specifying that a buffer named
493 <C>/mybuf/1</C> contains the string "&lt;a>contents&lt;/a>",
494 then the expression <C>document('arg:/mybuf/1')/a</C> has string-value
495 <C>"contents"</C>. If the document in <C>arg:/mybuf/1</C> contained
496 a relative URI reference <C>"../theirbuf/2"</C> then this would be
497 resolved as pointing to <C>"arg:/theirbuf/2"</C>.
501 <ENTRY id='.Errors and logs'>
502 <TYPE value='.Implementation Notes'/>
504 Sablotron writes error and warning messages to stderr, and does no logging
505 by default, but this behavior can be changed.
508 The name of the log file to be used can be specified with
509 <C>SablotSetLog</C>. Besides, you can use <C>SablotRegHandler</C>
510 to override the default message handling. The handler you register
511 will receive all messages in a structured form that's easy to process
512 and filter. For details, see <C>.Handlers</C>.
517 <ENTRY id='SablotHandle'>
518 <TYPE value='Types'/>
520 Defines the basic abstract handle for manipulation of Sablotron
524 typedef void *SablotHandle;
527 Actually this type is the <C>void*</C>, but you should never
532 <ENTRY id='SDOM_Document'>
533 <TYPE value='Types'/>
535 Handle for manipulation of Sablotron DOM documents.
538 typedef void *SDOM_Document;
541 You may use this type, if you need to deal with Sablotron
542 internal representation of the XML data model. There is a
543 DOM-like set of functions defined for such manipulation in the
548 <ENTRY id='SablotSituation'>
549 <TYPE value='Types'/>
551 Handle for manipulation of the Situation object.
554 typedef void *SablotSituation;
557 The Situation object is the very basic object you have to deal
558 with. See the <C>.Usage</C>
560 <SEEALSO value='SablotCreateSituation'/>
564 <ENTRY id='SablotCreateDocument'>
565 <TYPE value='Functions'/>
567 Creates a new DOM document.
570 int SablotCreateDocument(SablotSituation S,
572 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
573 <PARAM name='D' type='SDOM_Document*'>The new handle goes
577 The returned handle may be used to manipulate the internal DOM
578 document with the set of API defined in the sdom.h file.
580 <SEEALSO value='SDOM_Document'/>
583 <ENTRY id='SablotParse'>
584 <TYPE value='Functions'/>
586 Parses a XML file into the internal structure.
589 int SablotParse(SablotSituation S,
592 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
593 <PARAM name='uri' type='const char*'>URI of the file</PARAM>
594 <PARAM name='D' type='SDOM_Document*'>The new handle goes
598 Sablotron parses the document given by the URI and sets the D to
599 a new handle value. Returns FALSE on success.
603 <ENTRY id='SablotParseBuffer'>
604 <TYPE value='Functions'/>
606 Parses a XML string into the internal structure.
609 int SablotParseBuffer(SablotSituation S,
612 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
613 <PARAM name='buffer' type='const char*'>string to be parsed</PARAM>
614 <PARAM name='D' type='SDOM_Document*'>The node handle goes here</PARAM>
617 Sablotron parses given string and creates a new document
618 handle. The last parameter obtains the handle. Function returns
623 <ENTRY id='SablotParseStylesheet'>
624 <TYPE value='Functions'/>
626 Parses a XSLT stylesheet from file.
629 int SablotParseStylesheet(SablotSituation S,
632 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
633 <PARAM name='uri' type='const char*'>data URI</PARAM>
634 <PARAM name='D' type='SDOM_Document*'>The result goes here</PARAM>
637 Does the same as <C>SablotParse</C>, but document parsed with
638 this function may be used as the stylesheet for the XSLT
642 You should not modify a document created by this function, if
643 you want to use it for the processing. It might (and probably
644 would) lead to the processor crash.
648 <ENTRY id='SablotParseStylesheetBuffer'>
649 <TYPE value='Functions'/>
651 Parses a XSLT stylesheet from a buffer.
654 int SablotParseStylesheetBuffer(SablotSituation S,
657 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
658 <PARAM name='buffer' type='const char*'>XML string</PARAM>
659 <PARAM name='D' type='SDOM_Document*'>The result goes here</PARAM>
662 Does the same as <C>SablotParseBuffer</C>, but document parsed with
663 this function may be used as the stylesheet for the XSLT
667 You should not modify a document created by this function, if
668 you want to use it for the processing. It might (and probably
669 would) lead to the processor crash.
673 <ENTRY id='SablotLockDocument'>
674 <TYPE value='Functions'/>
676 Lock the document before the processing.
679 int SablotLockDocument(SablotSituation S,
681 <PARAM name='S' type='SablotSituation'>Situation object</PARAM>
682 <PARAM name='D' type='SDOM_Document'>document to be locked</PARAM>
685 Actually this function doesn't perform any locking in the common
686 sense of the word, but updates some internal values needed for
690 You SHOULD call this function whenever you changed the DOM
691 document before the processing. You don't need this, if you just
692 parsed the document (no modification).
696 <ENTRY id='SablotDestroyDocument'>
697 <TYPE value='Functions'/>
699 Frees the internal document and all resources.
702 int SablotDestroyDocument(SablotSituation S,
704 <PARAM name='S' type='SablotSituation'>Situation object</PARAM>
705 <PARAM name='D' type='SDOM_Document'>document to be destroyed</PARAM>
708 This function frees the internal document representation and all
713 <ENTRY id='SablotAddParam'>
714 <TYPE value='Functions'/>
716 Sets the value of the parameter for the processing.
719 int SablotAddParam(SablotSituation S,
721 const char *paramName,
722 const char *paramValue);
723 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
724 <PARAM name='processor_' type='void*'>Processor handle</PARAM>
725 <PARAM name='paramName' type='const char*'>parameter name</PARAM>
726 <PARAM name='paramValue' type='const char*'>parameter value</PARAM>
729 Use this function if you need to set the external parameter for
730 the upcoming processing (for the top-level <xsl:param>).
733 Currently the parameter value MUST be UTF-8 encoded.
735 <SEEALSO value='SablotRunProcessorGen'/>
736 <SEEALSO value='.Usage'/>
739 <ENTRY id='SablotAddArgBuffer'>
740 <TYPE value='Functions'/>
742 Adds a buffer containing the XML data as the named argument.
745 int SablotAddArgBuffer(SablotSituation S,
748 const char *bufferValue);
749 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
750 <PARAM name='processor_' type='void*'>Processor handle</PARAM>
751 <PARAM name='argName' type='const char*'>argument name</PARAM>
752 <PARAM name='bufferValue' type='const char*'>XML data</PARAM>
755 This API adds the named buffer to the list of arguments maintained
756 by the processor instance. Named arguments may be used either
757 while the processed data are specified (e.g. in
758 <C>SablotRunProcessorGen</C> or in the document() XSLT function.
760 <SEEALSO value='SablotAddArgTree'/>
763 <ENTRY id='SablotAddArgTree'>
764 <TYPE value='Functions'/>
766 Adds the pre-parsed tree as the named argument.
769 int SablotAddArgTree(SablotSituation S,
773 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
774 <PARAM name='processor_' type='void*'>Processor handle</PARAM>
775 <PARAM name='argName' type='const char*'>argument name</PARAM>
776 <PARAM name='tree' type='SDOM_Document'>tree handle</PARAM>
779 This function adds the named pre-parsed tree to the list of
780 arguments maintained by the processor instance. Named arguments
781 may be used either while the processed data are specified
782 (e.g. in <C>SablotRunProcessorGen</C> or in the document() XSLT
785 <SEEALSO value='SablotAddArgBuffer'/>
788 <ENTRY id='SablotRunProcessorGen'>
789 <TYPE value='Functions'/>
794 int SablotRunProcessorGen(SablotSituation S,
796 const char *sheetURI,
797 const char *inputURI,
798 const char *resultURI);
799 <PARAM name='S' type='SablotSituation'>Sablotron handle</PARAM>
800 <PARAM name='processor_' type='void*'>Processor handle</PARAM>
801 <PARAM name='sheetURI' type='const char*'>stylesheet URI</PARAM>
802 <PARAM name='inputURI' type='const char*'>data URI</PARAM>
803 <PARAM name='resultURI' type='const char*'>result URI</PARAM>
806 This call runs the processing on the given data. Data are
807 specified by URIs; what may be either of URI to the file, org
808 the 'arg:' scheme URI (see <C>SablotAddArg</C>). Other URI
809 schemes may be recognized if the appropriate handler is
812 <SEEALSO value='.Usage'/>
813 <SEEALSO value='.Handlers'/>
814 <SEEALSO value='SablotGetResultArg'/>
817 <ENTRY id='SablotRunProcessorExt'>
818 <TYPE value='Functions'/>
820 Runs the processor on the external document.
823 int SablotRunProcessorExt(SablotSituation S,
825 const char *sheetURI,
826 const char *resultURI,
828 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
829 <PARAM name='processor_' type='void*'>Processor handle</PARAM>
830 <PARAM name='sheetURI' type='const char*'>stylesheet URI</PARAM>
831 <PARAM name='resultURI' type='const char*'>result URI</PARAM>
832 <PARAM name='doc' type='NodeHandle'>external root node</PARAM>
835 This function acts as the SablotRunProcessorGen does. The
836 difference is, that the data processed are provided by the
837 external DOM provider.
839 See SXP documentation for more details on DOM providers etc.
842 Currently there is no way to start the processing on an
843 'ordinary' document and access the external data via some XSLT
844 function (opposite to the document() function).
846 <SEEALSO value='SablotRunProcessorGen'/>
849 <ENTRY id='SablotCreateSituation'>
850 <TYPE value='Functions'/>
852 Creates a situation object handle.
855 int SablotCreateSituation(SablotSituation *sPtr);
856 <PARAM name='sPtr' type='SablotSituation*'>the result goes here</PARAM>
859 This call creates a situation object. This object servers for
860 several reasons like error processing, option settings etc. Most
861 of API functions take the situation handle as their first parameter.
863 <SEEALSO value='.Usage'/>
866 <ENTRY id='SablotSetOptions'>
867 <TYPE value='Functions'/>
869 Sets miscellaneous processing options.
872 int SablotSetOptions(SablotSituation S,
874 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
875 <PARAM name='flag' type='int'>new options</PARAM>
878 Options may be any bitwise combination of following:
880 <C>SAB_NO_ERROR_REPORTING</C> suppresses the invocation of the
881 messages handler (if registered)
883 <C>SAB_PARSE_PUBLIC_ENTITIES</C> makes parser to resolve public
886 <C>SAB_DISABLE_ADDING_META</C> suppresses the generation of the
887 META tag (HTML output method)
889 <C>SAB_DISABLE_STRIPPING</C> suppresses the whitespace stripping
892 <C>SAB_IGNORE_DOC_NOT_FOUND</C> doesn't consider unresolved
893 documents (the document() function) to be lethal
895 <C>SAB_FILES_TO_HANDLER</C> do not read 'file' URI internally,
896 but pass it into the scheme handler
900 <ENTRY id='SablotGetOptions'>
901 <TYPE value='Functions'/>
903 Get current procesor options.
906 int SablotSetOptions(SablotSituation S,
908 <PARAM name='S' type='SablotSituation'>Situation handle</PARAM>
911 Options may be any bitwise combination of following:
913 <C>SAB_NO_ERROR_REPORTING</C> suppresses the invocation of the
914 messages handler (if registered)
916 <C>SAB_PARSE_PUBLIC_ENTITIES</C> makes parser to resolve public
919 <C>SAB_DISABLE_ADDING_META</C> suppresses the generation of the
920 META tag (HTML output method)
922 <C>SAB_DISABLE_STRIPPING</C> suppresses the whitespace stripping
925 <C>SAB_IGNORE_DOC_NOT_FOUND</C> doesn't consider unresolved
926 documents (the document() function) to be lethal
928 <C>SAB_FILES_TO_HANDLER</C> do not read 'file' URI internally,
929 but pass it into the scheme handler
933 <ENTRY id='SablotClearSituation'>
934 <TYPE value='Functions'/>
936 Clears the status of the situation.
939 int SablotClearSituation(SablotSituation S);
940 <PARAM name='S' type='SablotSituation'>situation handle</PARAM>
943 Clear all error info stored with the situation.
948 <ENTRY id='SablotGetErrorURI'>
949 <TYPE value='Functions'/>
951 Gets the last error URI.
954 const char *SablotGetErrorURI(SablotSituation S);
955 <PARAM name='S' type='SablotSituation'>situation handle</PARAM>
958 Returns the URI related to the location of the most recent
959 error. you must not free this string.
963 <ENTRY id='SablotGetErrorLine'>
964 <TYPE value='Functions'/>
966 Gets the last error line number.
969 int SablotGetErrorLine(SablotSituation S);
970 <PARAM name='S' type='SablotSituation'>desc</PARAM>
973 Returns the line number of the most recent error occured.
977 <ENTRY id='SablotGetErrorMsg'>
978 <TYPE value='Functions'/>
980 Gets the error message.
983 const char *SablotGetErrorMsg(SablotSituation S);
984 <PARAM name='S' type='SablotSituation'>desc</PARAM>
987 <C>SablotGetErrorMsg</C>
992 <ENTRY id='SablotDestroySituation'>
993 <TYPE value='Functions'/>
995 Destroys the situation object.
998 int SablotDestroySituation(SablotSituation S);
999 <PARAM name='S' type='SablotSituation'>desc</PARAM>
1002 Destroys the situation object. You should call this function as
1007 <ENTRY id='SablotCreateProcessor'>
1008 <TYPE value='Functions'/>
1010 Creates the processor object.
1013 int SablotCreateProcessor(SablotHandle *processorPtr);
1014 <PARAM name='processorPtr' type='SablotHandle*'>the result goes here</PARAM>
1017 This API creates the processor instance. See <C>.Usage</C> for
1018 the details to be done.
1021 This function is slightly obsoleted with
1022 <C>SablotCreateProcessorForSituation</C>, since we suppose you'd
1023 prefer the situation object recently created with
1024 <C>SablotCreateSituation</C>.
1028 <ENTRY id='SablotCreateProcessorForSituation'>
1029 <TYPE value='Functions'/>
1031 Creates the processor instance and associate it with the
1035 int SablotCreateProcessorForSituation(SablotSituation S,
1036 void **processorPtr);
1037 <PARAM name='S' type='SablotSituation'>situation handle</PARAM>
1038 <PARAM name='processorPtr' type='void**'>the result goes here</PARAM>
1041 Use this function if you want to create a processor instance and
1042 associate it with the given situation object. This call is
1043 preferred over <C>SablotCreateProcessor</C>.
1047 <ENTRY id='SablotDestroyProcessor'>
1048 <TYPE value='Functions'/>
1050 Destroys the processor object.
1053 int SablotDestroyProcessor(SablotHandle processor_);
1054 <PARAM name='processor_' type='SablotHandle'>Processor handle</PARAM>
1057 Destroys processor and all associated resources.
1061 <ENTRY id='SablotRunProcessor'>
1063 <TYPE value='Functions'/>
1065 Runs the XSLT transformation.
1068 int SablotRunProcessor(SablotHandle processor_,
1069 const char *sheetURI,
1070 const char *inputURI,
1071 const char *resultURI,
1072 const char* *params,
1073 const char* *argument);
1074 <PARAM name='processor_' type='SablotHandle'>processor handle</PARAM>
1075 <PARAM name='sheetURI' type='const char*'>sheet URI</PARAM>
1076 <PARAM name='inputURI' type='const char*'>data URI</PARAM>
1077 <PARAM name='resultURI' type='const char*'>result URI</PARAM>
1078 <PARAM name='params' type='const char**'>parameters</PARAM>
1079 <PARAM name='argument' type='const char**'>arguments</PARAM>
1082 This API is deprecated and shouldn't be used. Use
1083 <C>SablotRunProcessorGen</C> instead.
1087 <ENTRY id='SablotGetResultArg'>
1088 <TYPE value='Functions'/>
1090 Gets the result argument.
1093 int SablotGetResultArg(SablotHandle processor_,
1096 <PARAM name='processor_' type='SablotHandle'>Processor handle</PARAM>
1097 <PARAM name='argURI' type='const char*'>argument name</PARAM>
1098 <PARAM name='argValue' type='char**'>the result goes here</PARAM>
1101 This API is used to pull the data output to the 'arg:' scheme URI
1102 location. This happens during the transformation e.g. with
1103 <C>SablotRunProcessorGen</C>
1105 This function allocates new buffer for you. You have to free
1106 its memory with <C>SablotFree</C>, after you use it no more.
1110 <ENTRY id='SablotFreeResultArgs'>
1111 <TYPE value='Functions'/>
1113 Frees all internal result arguments.
1116 int SablotFreeResultArgs(SablotHandle processor_);
1117 <PARAM name='processor_' type='SablotHandle'>processor handle</PARAM>
1120 This call frees all memory associated with the output of the
1121 most recent transformation. You don't have to make this call,
1122 destroying the processor takes care as well as new
1123 transformation invocation.
1127 <ENTRY id='SchemeHandler'>
1128 <TYPE value='Types'/>
1130 This type is used to provide the Sablotron engine with a
1131 callback structure for a scheme handler.
1135 SchemeHandlerGetAll(void *userData,
1136 SablotHandle processor_,
1137 const char *scheme, const char *rest,
1138 char **buffer, int *byteCount);
1141 SchemeHandlerFreeMemory(void *userData,
1142 SablotHandle processor_,
1146 SchemeHandlerOpen(void *userData,
1147 SablotHandle processor_,
1149 const char *rest, int *handle);
1152 SchemeHandlerGet(void *userData,
1153 SablotHandle processor_,
1154 int handle, char *buffer, int *byteCount);
1157 SchemeHandlerPut(void *userData,
1158 SablotHandle processor_,
1159 int handle, const char *buffer, int *byteCount);
1162 SchemeHandlerClose(void *userData,
1163 SablotHandle processor_,
1168 SchemeHandlerGetAll *getAll;
1169 SchemeHandlerFreeMemory *freeMemory;
1170 SchemeHandlerOpen *open;
1171 SchemeHandlerGet *get;
1172 SchemeHandlerPut *put;
1173 SchemeHandlerClose *close;
1176 <NOTE>See the shandler.h file for more comments.</NOTE>
1179 <ENTRY id='MessageHandler'>
1180 <TYPE value='Types'/>
1182 This type is used to provide the Sablotron engine with a
1183 callback structure for a message handler.
1187 MessageHandlerMakeCode(
1188 void *userData, SablotHandle processor_,
1189 int severity, unsigned short facility, unsigned short code);
1193 void *userData, SablotHandle processor_,
1194 MH_ERROR code, MH_LEVEL level, char **fields);
1197 MessageHandlerError(void *userData, SablotHandle processor_,
1198 MH_ERROR code, MH_LEVEL level, char **fields);
1202 MessageHandlerMakeCode *makeCode;
1203 MessageHandlerLog *log;
1204 MessageHandlerError *error;
1207 <NOTE>See the shandler.h file for more comments.</NOTE>
1210 <ENTRY id='SAXHandler'>
1211 <TYPE value='Types'/>
1213 This type is used to provide the Sablotron engine with a
1214 callback structure for a SAX handler.
1218 SAXHandlerStartDocument(void* userData, SablotHandle processor_);
1221 SAXHandlerStartElement(void* userData, SablotHandle processor_,
1222 const char* name, const char** atts);
1225 SAXHandlerEndElement(void* userData, SablotHandle processor_,
1229 SAXHandlerStartNamespace(void* userData, SablotHandle processor_,
1230 const char* prefix, const char* uri);
1233 SAXHandlerEndNamespace(void* userData, SablotHandle processor_,
1234 const char* prefix);
1237 SAXHandlerComment(void* userData, SablotHandle processor_,
1238 const char* contents);
1241 SAXHandlerPI(void* userData, SablotHandle processor_,
1242 const char* target, const char* contents);
1245 SAXHandlerCharacters(void* userData, SablotHandle processor_,
1246 const char* contents, int length);
1249 SAXHandlerEndDocument(void* userData, SablotHandle processor_);
1254 SAXHandlerStartDocument *startDocument;
1255 SAXHandlerStartElement *startElement;
1256 SAXHandlerEndElement *endElement;
1257 SAXHandlerStartNamespace *startNamespace;
1258 SAXHandlerEndNamespace *endNamespace;
1259 SAXHandlerComment *comment;
1260 SAXHandlerPI *processingInstruction;
1261 SAXHandlerCharacters *characters;
1262 SAXHandlerEndDocument *endDocument;
1266 <NOTE>This is not a real SAX interface; think about it as about
1267 a SAX-like interface. See the shandler.h file for more
1271 <ENTRY id='MiscHandler'>
1272 <TYPE value='Types'/>
1274 This type is used to provide the Sablotron engine with a
1275 callback structure for a custom handler.
1279 MiscHandlerDocumentInfo(void* userData, SablotHandle processor_,
1280 const char *contentType, const char *encoding);
1284 MiscHandlerDocumentInfo *documentInfo;
1287 <NOTE>See the shandler.h file for more comments.</NOTE>
1290 <ENTRY id='EncHandler'>
1291 <TYPE value='Types'/>
1293 This type is used to provide the Sablotron engine with a
1294 callback structure for an encoding handler.
1297 typedef EHDescriptor
1298 EncHandlerOpen(void* userData,
1299 SablotHandle processor_,
1300 int direction, const char *encoding);
1303 EncHandlerConv(void* userData, SablotHandle processor_,
1304 EHDescriptor cd, const char** inbuf, size_t *inbytesleft,
1305 char ** outbuf, size_t *outbytesleft);
1308 EncHandlerClose(void* userData, SablotHandle processor_,
1313 EncHandlerOpen *open;
1314 EncHandlerConv *conv;
1315 EncHandlerClose *close;
1318 <NOTE>See the shandler.h file for more comments.</NOTE>
1321 <ENTRY id='SablotRegHandler'>
1322 <TYPE value='Functions'/>
1324 Registers new handler.
1327 int SablotRegHandler(SablotHandle processor_,
1331 <PARAM name='processor_' type='SablotHandle'>processor handle</PARAM>
1332 <PARAM name='type' type='HandlerType'>handler type</PARAM>
1333 <PARAM name='handler' type='void*'>pointer to the handler struct</PARAM>
1334 <PARAM name='userData' type='void*'>user data</PARAM>
1337 Registers one of available handlers. The handler type is either
1338 of HLR_MESSAGE, HLR_SCHEME, HLR_SAX, HLR_MISC, HLR_ENC. The
1339 ``handler'' parameter point to the callback structure.
1340 <P/>The stucture format depends on the handler sype specified.
1341 Possible callbacks structures are:<BR/>
1342 <C>SchemeHandler</C>, <C>MessageHandler</C>, <C>SAXHandler</C>,
1343 <C>MiscHandler</C>, <C>EncHandler</C>.
1345 <P/>See <C>.Handlers</C> for more.
1350 <ENTRY id='SablotUnregHandler'>
1351 <TYPE value='Functions'/>
1353 Unregisters the handler.
1356 int SablotUnregHandler(SablotHandle processor_,
1360 <PARAM name='processor_' type='SablotHandle'>processor handle</PARAM>
1361 <PARAM name='type' type='HandlerType'>handler type</PARAM>
1362 <PARAM name='handler' type='void*'>handler</PARAM>
1363 <PARAM name='userData' type='void*'>user data</PARAM>
1366 Registers one of available handlers. See <C>.Handlers</C> for more.
1370 <ENTRY id='SablotSetBase'>
1371 <TYPE value='Functions'/>
1376 int SablotSetBase(SablotHandle processor_,
1377 const char *theBase);
1378 <PARAM name='processor_' type='SablotHandle'>processor handle</PARAM>
1379 <PARAM name='theBase' type='const char*'>base URI</PARAM>
1382 Sets the base URI. All relatives URIs resolved during the
1383 processing are evaluated against this one.
1387 <ENTRY id='SablotSetBaseForScheme'>
1388 <TYPE value='Functions'/>
1390 Sets the base URI for given scheme.
1393 int SablotSetBaseForScheme(void *processor_,
1396 <PARAM name='processor_' type='void*'>processor handle</PARAM>
1397 <PARAM name='scheme' type='const char*'>desc</PARAM>
1398 <PARAM name='base' type='const char*'>desc</PARAM>
1401 <C>SablotSetBaseForScheme</C>
1405 <ENTRY id='SablotSetLog'>
1406 <TYPE value='Functions'/>
1408 Sets the log filename.
1411 int SablotSetLog(SablotHandle processor_,
1412 const char *logFilename,
1414 <PARAM name='processor_' type='SablotHandle'>desc</PARAM>
1415 <PARAM name='logFilename' type='const char*'>desc</PARAM>
1416 <PARAM name='logLevel' type='int'>desc</PARAM>
1419 The logLevel parameter is currently not used. Pass NULL for
1420 logFilename to turn logging off (default).
1424 <ENTRY id='SablotProcess'>
1426 <TYPE value='Functions'/>
1428 <C>SablotProcess</C>
1431 int SablotProcess(const char *sheetURI,
1432 const char *inputURI,
1433 const char *resultURI,
1434 const char* *params,
1435 const char* *arguments,
1437 <PARAM name='sheetURI' type='const char*'>desc</PARAM>
1438 <PARAM name='inputURI' type='const char*'>desc</PARAM>
1439 <PARAM name='resultURI' type='const char*'>desc</PARAM>
1440 <PARAM name='params' type='const char**'>desc</PARAM>
1441 <PARAM name='arguments' type='const char**'>desc</PARAM>
1442 <PARAM name='resultArg' type='char**'>desc</PARAM>
1445 <C>SablotProcess</C>
1449 <ENTRY id='SablotProcessFiles'>
1451 <TYPE value='Functions'/>
1453 <C>SablotProcessFiles</C>
1456 int SablotProcessFiles(const char *styleSheetName,
1457 const char *inputName,
1458 const char *resultName);
1459 <PARAM name='styleSheetName' type='const char*'>desc</PARAM>
1460 <PARAM name='inputName' type='const char*'>desc</PARAM>
1461 <PARAM name='resultName' type='const char*'>desc</PARAM>
1464 <C>SablotProcessFiles</C>
1468 <ENTRY id='SablotProcessStrings'>
1470 <TYPE value='Functions'/>
1472 <C>SablotProcessStrings</C>
1475 int SablotProcessStrings(const char *styleSheetStr,
1476 const char *inputStr,
1478 <PARAM name='styleSheetStr' type='const char*'>desc</PARAM>
1479 <PARAM name='inputStr' type='const char*'>desc</PARAM>
1480 <PARAM name='resultStr' type='char**'>desc</PARAM>
1483 <C>SablotProcessStrings</C>
1487 <ENTRY id='SablotProcessStringsWithBase'>
1489 <TYPE value='Functions'/>
1491 <C>SablotProcessStringsWithBase</C>
1494 int SablotProcessStringsWithBase(const char *styleSheetStr,
1495 const char *inputStr,
1497 const char *theHardBase);
1498 <PARAM name='styleSheetStr' type='const char*'>desc</PARAM>
1499 <PARAM name='inputStr' type='const char*'>desc</PARAM>
1500 <PARAM name='resultStr' type='char**'>desc</PARAM>
1501 <PARAM name='theHardBase' type='const char*'>desc</PARAM>
1504 <C>SablotProcessStringsWithBase</C>
1508 <ENTRY id='SablotFree'>
1509 <TYPE value='Functions'/>
1511 <C>SablotFree</C> frees the buffer formerly allocated by the engine.
1514 int SablotFree(char *resultStr);
1515 <PARAM name='resultStr' type='char*'>desc</PARAM>
1518 Use the <C>SablotFree</C> function whenever you finish a work
1519 with a Sablotron generated API. Typically, do it after the
1520 <C>SablotrGetResultArg</C> is called. Some DOM-access
1521 functions allocate buffers too.
1525 <ENTRY id='SablotClearError'>
1526 <TYPE value='Functions'/>
1528 Clears the 'pending error' flag.
1531 int SablotClearError(SablotHandle processor_);
1532 <PARAM name='processor_' type='SablotHandle'>desc</PARAM>
1535 Clears the 'pending error' flag for this instance of Sablotron.
1539 <ENTRY id='SablotGetMsgText'>
1540 <TYPE value='Functions'/>
1542 <C>SablotGetMsgText</C> return a constant pointer to the message
1543 for the given error code.
1546 const char *SablotGetMsgText(int code);
1547 <PARAM name='code' type='int'>desc</PARAM>
1550 The value returned is typically a format string (contains C
1551 ``printf'' formatting specifiers). You need more info (code
1552 dependent) to get a full message).
1556 <ENTRY id='SablotSetInstanceData'>
1557 <TYPE value='Functions'/>
1559 <C>SablotSetInstanceData</C> associates user-defined pointer to
1560 the processor instance.
1563 void SablotSetInstanceData(SablotHandle processor_,
1565 <PARAM name='processor_' type='SablotHandle'>desc</PARAM>
1566 <PARAM name='idata' type='void*'>desc</PARAM>
1569 You may use this call to store any pointer-like value with the
1570 processor. You may obtain this value later usinf the
1571 <C>SablotGetInstanceData</C>. This is usefull for miscellaneous
1572 wrapper implementations etc.
1576 <ENTRY id='SablotGetInstanceData'>
1577 <TYPE value='Functions'/>
1579 <C>SablotGetInstanceData</C> reads the user data stored with
1580 processor recently with <C>SablotSetInstanceData</C>
1583 void *SablotGetInstanceData(SablotHandle processor_);
1584 <PARAM name='processor_' type='SablotHandle'>desc</PARAM>
1587 <C>SablotGetInstanceData</C>
1591 <ENTRY id='SablotSetEncoding'>
1592 <TYPE value='Functions'/>
1594 <C>SablotSetEncoding</C> sets the encoding for the output document.
1597 void SablotSetEncoding(SablotHandle processor_,
1599 <PARAM name='processor_' type='SablotHandle'>desc</PARAM>
1600 <PARAM name='encoding_' type='char*'>desc</PARAM>
1603 The encoding set via the <C>SablotSetEncoding</C> call overrides
1604 a stylesheet-defined value.
1608 <ENTRY id='.Sablotron DOM'>
1611 Sablotron implements <S>DOM Level2</S> API.
1614 This book contains a brief description of the implemented interface
1615 only; for more details, please refer to the header file named sdom.h.
1617 Sablotron DOM interface includes types (see <C>DOM types</C>) and
1618 functions (see <C>DOM functions</C>). All of the names related to
1619 the DOM interface start with SDOM_ (for Sablot DOM).
1621 As Sablotron provides a C API for the object-oriented Document Object Model,
1622 you can't not expect the API follows the DOM specs literally. Instead,
1623 it maps object methods to plain functions, one to one usually.
1624 This arrangement makes it possible to write the specs compliant object
1625 oriented wrappers over the Sablotron DOM API. XML::Sablotron::DOM written
1626 in Perl is the primary example. See <C>.Known Issues</C> for the list
1627 of minor deviations from the DOM Level 2 specs.
1629 <EXTERNALREF name="DOM Level2" value="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/"/>
1632 <ENTRY id='DOM types'>
1635 Types introduced by <C>.Sablotron DOM</C> Level 2 interface.
1638 Major new types are <C>SDOM_Document</C> (a DOM tree) and
1639 <B>SDOM_Node</B> (a node of the tree). A document can also be used in
1640 place of a node. This corresponds to the DOM spec, Document is a subclass
1641 of Node. When used in this way, the document represents its own root node
1642 (which is not the same as the `root element' aka 'document element').
1644 Other types include:
1646 <B>SDOM_char</B>: a DOM character type. Currently, this is just char.
1647 Note that the DOM spec requires that the DOM implementations work with
1648 UTF-16. Sablotron deviates from this by using UTF-8 instead.
1650 <B>SDOM_NodeType</B>: a node type enum. Some of the values are
1651 SDOM_ELEMENT_NODE, SDOM_ATTRIBUTE_NODE and SDOM_TEXT_NODE. See sdom.h
1654 <B>SDOM_NodeList</B>: a node list returned by some of the functions.
1656 <B>SDOM_Exception</B>: DOM exception codes enum, with values such as
1657 SDOM_NOT_FOUND_ERR or SDOM_INVALID_NODE_TYPE. See sdom.h for details.
1661 <ENTRY id='DOM functions'>
1664 Functions introduced by <C>.Sablotron DOM</C> Level 2 interface.
1667 The functions listed below are implemented as defined in the
1668 <C>DOM Level 2</C> specification, with two exceptions: their names are
1669 prefixed with SDOM_ and the first argument is always a SablotSituation.
1670 All the functions return a value of SDOM_Exception type. The functions
1671 aren't described in details as they correspond to well known DOM methods.
1672 Please, look to sdom.h for more details.
1674 <C>createElement</C>, <C>createElementNS</C>, <C>createAttribute</C>,
1675 <C>createAttributeNS</C>, <C>createTextNode</C>, <C>createCDATASection</C>,
1676 <C>createComment</C>, <C>createProcessingInstruction</C>
1678 <C>getNodeType</C>, <C>getNodeName</C>, <C>getNodeNSUri</C>,
1679 <C>getNodePrefix</C>, <C>getNodeLocalName</C>, <C>setNodeName</C>,
1680 <C>getNodeValue</C>, <C>setNodeValue</C>
1682 <C>getParentNode</C>, <C>getFirstChild</C>, <C>getLastChild</C>,
1683 <C>getPreviousSibling</C>, <C>getNextSibling</C>, <C>getChildNodeIndex</C>,
1684 <C>getChildNodeCount</C>, <C>getOwnerDocument</C>
1686 <C>insertBefore</C>, <C>appendChild</C>, <C>removeChild</C>,
1691 <C>getAttribute</C>, <C>getAttributeNS</C>, <C>getAttributeNode</C>,
1692 <C>getAttributeNodeNS</C>, <C>getAttributeNodeIndex</C>,
1693 <C>getAttributeNodeCount</C>, <C>setAttribute</C>, <C>setAttributeNS</C>,
1694 <C>setAttributeNode</C>, <C>setAttributeNodeNS</C>, <C>removeAttribute</C>,
1695 <C>removeAttributeNode</C>, <C>getAttributeElement</C>,
1696 <C>getAttributeList</C>
1698 Several functions have been added:
1700 <C>disposeNode</C> frees all memory used by the given node.
1702 <C>cloneForeignNode</C> clones a node from a different document.
1704 <C>docToString</C> serializes the document, returning the resulting string.
1706 <C>nodeToString</C> serializes a node (and its descendants), returning
1707 the resulting string.
1709 <C>xql</C> performs an XPath query on the DOM tree, returning a list of the
1710 nodes satisfying the query.
1712 In addition, there are some functions used to manipulate the node lists
1713 returned by xql and getAttributeList functions. These include
1714 <C>getNodeListLength</C>, <C>getNodeListItem</C> and <C>disposeNodeList</C>.
1716 Finally, there are functions to extract DOM exception-related information
1717 from the situation object, namely <C>getExceptionCode</C>,
1718 <C>getExceptionMessage</C> and <C>getExceptionDetails</C>.