typos
[cxml-rng.git] / index.xml
blob65d41afcb436671e74c3902d252acd5937561ced
1 <page>
2   <p>
3     An implementation
4     of <a href="http://relaxng.org/spec-20011203.html">Relax
5       NG</a> schema validation
6     written in Common
7     Lisp, including support for compact syntax and the XSD type
8     library.
9   </p>
10   <p>
11     cxml-rng was written
12     by <a href="mailto:david@lichteblau.com">David
13       Lichteblau</a> and is designed as an add-on library for
14     <a href="http://common-lisp.net/project/cxml">Closure XML</a>.
15     It is available under an X11-style license.
16   </p>
17   <p>
18     Please send bug reports
19     to <a href="mailto:cxml-devel@common-lisp.net">
20       cxml-devel@common-lisp.net</a>
21     (<a href="http://common-lisp.net/cgi-bin/mailman/listinfo/cxml-devel">list information</a>).
22   </p>
24   <h3>Download and Installation</h3>
26   <p>
27     Download cxml-rng
28     <a href="http://www.lichteblau.com/cxml-rng/download/">tarballs</a>
29     or get it from git: <tt>http://www.lichteblau.com/git/cxml-rng.git</tt>
30   </p>
31   <p>
32     cxml-rng needs
33     <a href="http://common-lisp.net/project/cxml">Closure XML</a>, 
34     <a href="http://weitz.de/cl-ppcre/">CL-PPCE</a>,
35     <a href="http://www.pps.jussieu.fr/~jch/software/cl-yacc/">CL-Yacc</a>,
36     <a href="http://www.cliki.net/PARSE-NUMBER">parse-number</a>,
37     and <a href="http://www.cliki.net/cl-base64">cl-base64</a>.
38     <a href="http://www.cliki.net/asdf">ASDF</a> is used for
39     compilation.  Register the .asd file, e.g. by symlinking it,
40     then compile cxml-rng using <tt>asdf:operate</tt>.
41   </p>
42   <pre>$ ln -sf `pwd`/cxml-rng.asd /path/to/your/registry/
43 * (asdf:operate 'asdf:load-op :cxml-rng)</pre>
45   <h3>Implementation-specific notes</h3>
46   <p>
47     At this point, cxml-rng is written to work with Lisp strings
48     (as opposed to runes and rods), and is meant to be used on
49     Lisp implementations with Unicode support.
50   </p>
52   <h3>Example</h3>
53   <p>
54     Use <a href="doc/pages/cxml-rng__parse-schema.html">cxml-rng:parse-schema</a>
55     to parse a Relax NG schema file.  The
56     resulting <a
57                  href="doc/pages/cxml-rng__schema.html">schema</a>
58     object is a representation of a simplified schema using Lisp
59     objects, which has gone through most stages of simplification as
60     described the Relax NG
61     specification.  <a href="doc/pages/cxml-rng__serialize-schema.html">cxml-rng:serialize-schema</a>
62     can be used to write a Relax NG file in XML syntax for this
63     grammar.
64   </p>
65   <p>
66     In order to validate XML against a schema, create a
67     validation handler for the grammar
68     using <a href="doc/pages/cxml-rng__make-validator.html">cxml-rng:make-validator</a>.
69     The validation
70     handler processes SAX events and can be used with any
71     function generating such events, in particular
72     with <a
73             href="http://common-lisp.net/project/cxml/sax.html#parser">cxml:parse-file</a>.
74   </p>
75   <pre class="code">(cxml:parse-file "example.xml"
76                  <blau>(cxml-rng:make-validator
77                   (cxml-rng:parse-schema #p"example.rng"))</blau>)</pre>
78   <p>
79     In order to validate while also processing events with
80     another handler, use a broadcast handler.  For example, to
81     parse XML into DOM while also validating it, broadcast to
82     the validator and DOM builder (in that order):
83   </p>
84   <pre class="code" style="color: #777777">(cxml:parse-file "example.xml"
85                  <blau>(cxml:make-broadcast-handler</blau>
86                   (cxml-rng:make-validator
87                    (cxml-rng:parse-schema #p"example.rng"))
88                   <blau>(cxml-dom:make-dom-builder))</blau>)</pre>
89   <p>
90     To validate with the klacks parser, use a tapping source.
91   </p>
92   <pre class="code" style="color: #777777">(klacks:with-open-source
93     (s <blau>(klacks:make-tapping-source</blau>
94         (cxml:make-source #p"example.xml")
95         <blau>(cxml-rng:make-validator 
96          (cxml-rng:parse-schema #p"example.rng"))</blau>))
97   (loop for key = (klacks:peek-next s) while key do (print key)))</pre>
99   <h3>Documentation</h3>
100   <p>
101     <a href="doc/index.html">API documentation</a> is available.
102   </p>
103 </page>