Compact syntax parsing fixes
[cxml-rng.git] / index.html
blob9eb650738a8e8f595c4cec43f767e0a285301be2
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>
6 cxml-rng: Relax NG for Closure XML
7 </title>
8 <link rel="stylesheet" type="text/css" href="index.css">
9 </head>
10 <body style="width: 62em">
11 <div id="header"><div style="margin-left: 15px"><b><span>cxml–</span><span style="color: #ff9500">rng</span>
12   
13 Relax NG for Closure XML
14 </b></div></div>
15 <div id="homepage" class="main">
16 <p>
17 An implementation
18 of <a href="http://relaxng.org/spec-20011203.html">Relax
19 NG</a> schema validation
20 written in Common
21 Lisp, including support for compact syntax, DTD Compatibility, and
22 the XSD type library.
23 </p>
24 <p>
25 cxml-rng was written
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.
30 </p>
31 <p>
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>).
36 </p>
38 <h3>Download and Installation</h3>
40 <!--
41 <p>
42 Download cxml-rng
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>
45 </p>
46 -->
47 <p>
48 Download a cxml-rng
49 <a href="http://www.lichteblau.com/cxml-rng/download/">tarball</a>.
50 </p>
51 <p>
52 cxml-rng needs
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>.
61 </p>
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>
66 <p>
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.
70 </p>
72 <h3>Documentation</h3>
73 <p>
74 <a href="doc/index.html">API documentation</a> is available.
75 </p>
77 <h3>Example</h3>
78 <p>
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
87 grammar.
88 </p>
89 <p>
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>.
93 The validation
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>.
97 </p>
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:
105 </p>
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.
112 </p>
113 <pre class="code" style="color: #777777">(klacks:with-open-source
114 (s <span style="color: black">(cxml-rng:make-validating-source
115 #p"example.xml"
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.
123 </p>
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-11-30</b></p>
131 <ul>
132 <li>
133 Build fix: Upgraded to current cl-ppcre.
134 </li>
135 <li>
136 Use 21 bit characters on Lisps offering them.
137 (Also fixes OpenMCL issues.)
138 </li>
139 </ul>
140 <p><b>2007-10-21</b></p>
141 <ul>
142 <li>
143 Slightly better error messages around attribute issues.
144 </li>
145 <li>
146 Update to current CXML.
147 </li>
148 </ul>
149 <p><b>2007-07-01</b></p>
150 <ul>
151 <li>
152 Allows comments in grammar contents.
153 </li>
154 </ul>
155 <p><b>2007-05-26</b></p>
156 <ul>
157 <li>
158 Initial public release.
159 </li>
160 </ul>
161 </div>
162 </body>
163 </html>