4 #:rng-error-line-number
5 #:rng-error-column-number
54 #:name-class-choice-b
)
56 "@code{cxml-rng} implements @a[http://relaxng.org/spec-20011203.html]{
57 Relax NG} schema validation for Closure XML.
59 Support for @a[http://relaxng.org/compact-20021121.html]{Compact Syntax}
62 @begin[Example]{section}
64 (cxml:parse-file \"test.xml\"
65 (cxml-rng:make-validator
66 (cxml-rng:parse-schema #p\"test.rng\")))
69 @begin[Classes]{section}
71 @aboutclass{rng-error}
73 @begin[Parsing and validating]{section}
74 @aboutfun{parse-schema}
75 @aboutfun{parse-compact}
76 @aboutfun{make-validator}
77 @aboutfun{serialize-grammar}
79 @begin[Grammar introspection]{section}
80 The following classes and function are exported so that users can
81 take a peek at the internals of the parsed and simplified grammar.
83 @aboutfun{schema-start}
84 @aboutclass{attribute}
90 @aboutclass{interleave}
91 @aboutclass{list-pattern}
92 @aboutclass{not-allowed}
93 @aboutclass{one-or-more}
98 @aboutfun{pattern-child}
101 @aboutfun{pattern-name}
102 @aboutfun{pattern-element}
103 @aboutfun{pattern-type}
104 @aboutfun{pattern-string}
105 @aboutfun{pattern-value}
106 @aboutfun{pattern-params}
107 @aboutfun{pattern-except}
110 (defpackage :cxml-types
121 #:type-context-dependent-p
127 #:sax-validation-context-mixin
128 #:klacks-validation-context
129 #:make-klacks-validation-context
130 #:context-find-namespace-binding
131 #:context-find-unparsed-entity
158 #:normalized-string-type
171 #:non-positive-integer-type
172 #:negative-integer-type
177 #:non-negative-integer-type
180 #:unsigned-short-type
182 #:positive-integer-type
)
184 "@code{cxml-types} defines an extensible interface for XML-related
185 data types as required for use in Relax NG validation.
186 It includes Relax NG's minimal built-in type library, which is named
187 @code{:||} and defines the types \"string\" and \"token\".
188 In addition, it implements the built-in types of
189 @a[http://www.w3.org/TR/xmlschema-2/]{XML Schema Datatypes}
190 as specified in @a[http://relaxng.org/xsd-20010907.html]{Guidelines for
191 using W3C XML Schema Datatypes with RELAX NG}. The XSD type library
192 is named @code{:|http://www.w3.org/2001/XMLSchema-datatypes|}.
194 @begin[Example]{section}
196 * (setf ttt (cxml-types:find-type :|| \"token\"))
197 #<CXML-TYPES:TOKEN-TYPE {1002D16B71@}>
198 * (cxml-types:parse ttt \"a b\")
200 * (cxml-types:parse ttt \"a b\")
202 * (cxml-types:equal-using-type ttt ** *)
206 @begin[Type instances]{section}
207 Each type, together with its parameters, is represented by an
208 instance of @code{data-type}. The generic function @fun{find-type},
209 defined for each library, creates type instances. A type's properties
210 are accessible using @fun{type-name}, @fun{type-library}, and
211 @fun{type-context-dependent-p}.
213 @aboutclass{data-type}
214 @aboutclass{rng-type}
215 @aboutclass{xsd-type}
218 @aboutfun{type-library}
219 @aboutfun{type-context-dependent-p}
221 @begin[Using types]{section}
222 Types allow strings to be tested for validity and equality.
223 @fun{validp} checks whether a string can be parsed. If it is valid,
224 @fun{parse} will compute the string's @emph{value}, and return a
225 Lisp object of a type-specific class as a representation of that value.
226 Values returned by @fun{parse} can be compared for equality using
227 @fun{equal-using-type}. Some types also define a partial ordering,
228 which can be queried using @fun{lessp-using-type}.
232 @aboutfun{equal-using-type}
233 @aboutfun{lessp-using-type}
235 @begin[The validation context]{section}
236 Some types are context dependent, as indicated by
237 @fun{type-context-dependent-p}. Those types need access to state
238 computed by the XML parser implicitly, like namespace bindings or
241 An abstract class @class{validation-context} is defined that
242 users of this API can implement a subclass of
243 to define methods for the generic functions listed below.
245 In addition, two pre-defined validation context implementations are
246 provided, one for use with SAX, the other based on Klacks.
248 @aboutclass{validation-context}
249 @aboutclass{sax-validation-context-mixin}
250 @aboutclass{klacks-validation-context}
251 @aboutfun{context-find-namespace-binding}
252 @aboutfun{context-find-unparsed-entity}
254 @begin[Primitive XSD built-in types]{section}
255 The following primitive types are part of the XSD built-in data type
258 @aboutclass{duration-type}
259 @aboutclass{date-time-type}
260 @aboutclass{time-type}
261 @aboutclass{date-type}
262 @aboutclass{year-month-type}
263 @aboutclass{year-type}
264 @aboutclass{month-day-type}
265 @aboutclass{day-type}
266 @aboutclass{month-type}
267 @aboutclass{boolean-type}
268 @aboutclass{base64-binary-type}
269 @aboutclass{hex-binary-type}
270 @aboutclass{float-type}
271 @aboutclass{decimal-type}
272 @aboutclass{double-type}
273 @aboutclass{any-uri-type}
274 @aboutclass{qname-type}
275 @aboutclass{notation-type}
276 @aboutclass{xsd-string-type}
278 @begin[Enumerated XSD built-in types]{section}
279 The following types are part of the XSD built-in data type
280 library, and are defined as derived types through enumeration.
281 Relax NG does not implement the enumeration facet, so although these
282 types are described as \"derived\", they are implemented directly.
284 @aboutclass{idrefs-type}
285 @aboutclass{entities-type}
286 @aboutclass{nmtokens-type}
288 @begin[Derived XSD built-in types]{section}
289 The following types are part of the XSD built-in data type
290 library, and are defined as derived types through restriction.
292 @aboutclass{normalized-string-type}
293 @aboutclass{xsd-token-type}
294 @aboutclass{language-type}
295 @aboutclass{name-type}
296 @aboutclass{ncname-type}
298 @aboutclass{idref-type}
299 @aboutclass{entity-type}
300 @aboutclass{nmtoken-type}
301 @aboutclass{integer-type}
302 @aboutclass{non-positive-integer-type}
303 @aboutclass{negative-integer-type}
304 @aboutclass{long-type}
305 @aboutclass{int-type}
306 @aboutclass{short-type}
307 @aboutclass{bite-type}
308 @aboutclass{non-negative-integer-type}
309 @aboutclass{unsigned-long-type}
310 @aboutclass{unsigned-int-type}
311 @aboutclass{unsigned-short-type}
312 @aboutclass{unsigned-byte-type}
313 @aboutclass{positive-integer-type}