In xsltproc
mode (XSLT), XML data is represented as a tree of C structures. In guile
mode (Scheme), the same data is automatically represented using SXML format.
From the SXML specification:
SXML is an abstract syntax tree of an XML document. SXML is also a concrete representation of the XML Infoset in the form of S-expressions. The generic tree structure of SXML lends itself to a compact library of combinators for querying and transforming SXML.
Example 2. Simple document in XML format
<article id="hw"> <title>Hello</title> <para>Hello <object>World</object>!</para> </article>
Example 3. Simple document in SXML format
(article (@ (id "hw")) (title "Hello") (para "Hello " (object "World") "!"))
XSieve supports all features of the SXML specification except
an auxiliary node attached to the *TOP*
node, and
unexpanded external entities.
The SXML format doesn't support unexpanded entities. Sometimes it is a serious limitation. To break the limitation, XSieve uses a dialect of SXML that is SXML plus a special &
form. The form is borrowed from HtmlPrag, a permissive HTML parsing library by Neil W. Van Dyke.
Example 4. Unexpanded entities in XML and SXML
XML:
<x>&product; —</x>
SXML:
(*TOP* (x (& product) (& nbsp) (& mdash)))
The second element of the &
form can be a string, symbol, or (for character ordinal values) a nonnegative integer.