1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
6 cxml-rng: Relax NG for Closure XML
8 <link rel=
"stylesheet" type=
"text/css" href=
"index.css">
10 <body style=
"width: 62em">
11 <div id=
"header"><div style=
"margin-left: 15px"><b><span>cxml–
</span><span style=
"color: #ff9500">rng
</span>
13 Relax NG for Closure XML
15 <div id=
"homepage" class=
"main">
18 of
<a href=
"http://relaxng.org/spec-20011203.html">Relax
19 NG
</a> schema validation
21 Lisp, including support for compact syntax, DTD Compatibility, and
26 by
<a href=
"mailto:david@lichteblau.com">David
27 Lichteblau
</a> and is designed as an add-on library for
28 <a href=
"http://common-lisp.net/project/cxml">Closure XML
</a>.
29 It is available under an X11-style license.
32 Please send bug reports
33 to
<a href=
"mailto:cxml-devel@common-lisp.net">
34 cxml-devel@common-lisp.net
</a>
35 (
<a href=
"http://common-lisp.net/cgi-bin/mailman/listinfo/cxml-devel">list information
</a>).
38 <h3>Download and Installation
</h3>
43 <a href="http://www.lichteblau.com/cxml-rng/download/">tarballs</a>
44 or get it from git: <tt>http://www.lichteblau.com/git/cxml-rng.git</tt>
49 <a href=
"http://www.lichteblau.com/cxml-rng/download/">tarball
</a>.
53 <a href=
"http://common-lisp.net/project/cxml">Closure XML
</a>,
54 <a href=
"http://weitz.de/cl-ppcre/">CL-PPCE
</a>,
55 <a href=
"http://www.pps.jussieu.fr/~jch/software/cl-yacc/">CL-Yacc
</a>,
56 <a href=
"http://www.cliki.net/PARSE-NUMBER">parse-number
</a>,
57 and
<a href=
"http://www.cliki.net/cl-base64">cl-base64
</a>.
58 <a href=
"http://www.cliki.net/asdf">ASDF
</a> is used for
59 compilation. Register the .asd file, e.g. by symlinking it,
60 then compile cxml-rng using
<tt>asdf:operate
</tt>.
62 <pre>$ ln -sf `pwd`/cxml-rng.asd /path/to/your/registry/
63 * (asdf:operate 'asdf:load-op :cxml-rng)
</pre>
65 <h3>Implementation-specific notes
</h3>
67 At this point, cxml-rng is written to work with Lisp strings
68 (as opposed to runes and rods), and is meant to be used on
69 Lisp implementations with Unicode support.
72 <h3>Documentation
</h3>
74 <a href=
"doc/index.html">API documentation
</a> is available.
79 Use
<a href=
"doc/pages/cxml-rng__parse-schema.html">cxml-rng:parse-schema
</a>
80 to parse a Relax NG schema file. The
81 resulting
<a href=
"doc/pages/cxml-rng__schema.html">schema
</a>
82 object is a representation of a simplified schema using Lisp
83 objects, which has gone through simplification as
84 described the Relax NG
85 specification.
<a href=
"doc/pages/cxml-rng__serialize-schema.html">cxml-rng:serialize-schema
</a>
86 can be used to write a Relax NG file in XML syntax for this
90 In order to validate XML against a schema, create a
91 validation handler for the grammar
92 using
<a href=
"doc/pages/cxml-rng__make-validator.html">cxml-rng:make-validator
</a>.
94 handler processes SAX events and can be used with any
95 function generating such events, in particular
96 with
<a href=
"http://common-lisp.net/project/cxml/sax.html#parser">cxml:parse-file
</a>.
98 <pre class=
"code">(cxml:parse-file
"example.xml"
99 <span style=
"color: black">(cxml-rng:make-validator
100 (cxml-rng:parse-schema #p
"example.rng"))
</span>)
</pre>
102 The validator accepts another SAX handler as an optional
103 second argument. For example, to parse XML into DOM while also
104 validating it, use the validator like this:
106 <pre class=
"code" style=
"color: #777777">(cxml:parse-file
"example.xml"
107 <span style=
"color: black">(cxml-rng:make-validator
</span>
108 (cxml-rng:parse-schema #p
"example.rng")
109 <span style=
"color: black">(cxml-dom:make-dom-builder))
</span>)
</pre>
111 When using the klacks parser, create a validating source.
113 <pre class=
"code" style=
"color: #777777">(klacks:with-open-source
114 (s
<span style=
"color: black">(cxml-rng:make-validating-source
116 (cxml-rng:parse-schema #p
"example.rng"))
</span>)
117 (loop for key = (klacks:peek-next s) while key do (print key)))
</pre>
119 DTD Compatibility processing (basically, checking of IDs and
120 addition of default values) is done using a
121 <a href=
"doc/pages/cxml-rng__make-dtd-compatibility-handler.html">DTD Compatibility handler
</a>.
122 You can use this handler together with a validator or by its own.
124 <pre class=
"code" style=
"color: #777777">(cxml:parse-file
"example.xml"
125 <span style=
"color: black">(cxml-rng:make-dtd-compatibility-handler
</span>
126 (cxml-rng:parse-schema #p
"example.rng")
127 <span style=
"color: black">(cxml-dom:make-dom-builder))
</span>)
</pre>
129 <h3>Recent changes
</h3>
130 <p><b>2008-
03-dd
</b></p>
133 Use
21 bit characters on Lisps offering them.
134 (Also fixes OpenMCL issues.)
137 <p><b>2007-
10-
21</b></p>
140 Slightly better error messages around attribute issues.
143 Update to current CXML.
146 <p><b>2007-
07-
01</b></p>
149 Allows comments in grammar contents.
152 <p><b>2007-
05-
26</b></p>
155 Initial public release.