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
116 #:type-context-dependent-p
121 #:sax-validation-context-mixin
122 #:klacks-validation-context
123 #:make-klacks-validation-context
124 #:context-find-namespace-binding
149 #:normalized-string-type
162 #:non-positive-integer-type
163 #:negative-integer-type
168 #:non-negative-integer-type
171 #:unsigned-short-type
173 #:positive-integer-type
)
175 "@code{cxml-types} defines an extensible interface for XML-related
176 data types as required for use in Relax NG validation.
177 It includes Relax NG's minimal built-in type library, which is named
178 @code{:||} and defines the types \"string\" and \"token\".
179 In addition, it implements the built-in types of
180 @a[http://www.w3.org/TR/xmlschema-2/]{XML Schema Datatypes}
181 as specified in @a[http://relaxng.org/xsd-20010907.html]{Guidelines for
182 using W3C XML Schema Datatypes with RELAX NG}. The XSD type library
183 is named @code{:|http://www.w3.org/2001/XMLSchema-datatypes|}.
185 @begin[Example]{section}
187 * (setf ttt (cxml-types:find-type :|| \"token\"))
188 #<CXML-TYPES:TOKEN-TYPE {1002D16B71@}>
189 * (cxml-types:parse ttt \"a b\")
191 * (cxml-types:parse ttt \"a b\")
193 * (cxml-types:equal-using-type ttt ** *)
197 @begin[Type instances]{section}
198 Each type, together with its parameters, is represented by an
199 instance of @code{data-type}. The generic function @fun{find-type},
200 defined for each library, creates type instances. A type's properties
201 are accessible using @fun{type-name}, @fun{type-library}, and
202 @fun{type-context-dependent-p}.
204 @aboutclass{data-type}
205 @aboutclass{rng-type}
206 @aboutclass{xsd-type}
209 @aboutfun{type-library}
210 @aboutfun{type-context-dependent-p}
212 @begin[Using types]{section}
213 Types allow strings to be tested for validity and equality.
214 @fun{validp} checks whether a string can be parsed. If it is valid,
215 @fun{parse} will compute the string's @emph{value}, and return a
216 Lisp object of a type-specific class as a representation of that value.
217 Values returned by @fun{parse} can be compared for equality using
218 @fun{equal-using-type}.
222 @aboutfun{equal-using-type}
224 @begin[The validation context]{section}
225 Some types are context dependent, as indicated by
226 @fun{type-context-dependent-p}. Those types need access to state
227 computed by the XML parser implicitly, like namespace bindings or
230 An abstract class @class{validation-context} is defined that
231 users of this API can implement a subclass of
232 to define methods for the generic functions listed below.
234 In addition, two pre-defined validation context implementations are
235 provided, one for use with SAX, the other based on Klacks.
237 @aboutclass{validation-context}
238 @aboutclass{sax-validation-context-mixin}
239 @aboutclass{klacks-validation-context}
240 @aboutfun{context-find-namespace-binding}