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