38 "@code{cxml-rng} implements @a[http://relaxng.org/spec-20011203.html]{
39 Relax NG} schema validation for Closure XML.
41 @begin[Example]{section}
43 (cxml:parse-file \"test.xml\"
44 (cxml-rng:make-validator
45 (cxml-rng:parse-schema #p\"test.rng\")))
48 @begin[Classes]{section}
49 @aboutclass{parsed-grammar}
50 @aboutclass{rng-error}
52 @begin[Parsing and validating]{section}
53 @aboutfun{parse-schema}
54 @aboutfun{make-validator}
55 @aboutfun{serialize-grammar}
57 @begin[Grammar introspection]{section}
58 The following classes and function are exported so that users can
59 take a peek at the internals of the parsed and simplified grammar.
61 @aboutfun{parsed-grammar-pattern}
62 @aboutclass{attribute}
68 @aboutclass{interleave}
69 @aboutclass{list-pattern}
70 @aboutclass{not-allowed}
71 @aboutclass{one-or-more}
76 @aboutfun{pattern-child}
79 @aboutfun{pattern-name}
80 @aboutfun{pattern-resolved-target}
81 @aboutfun{pattern-type}
82 @aboutfun{pattern-string}
83 @aboutfun{pattern-value}
84 @aboutfun{pattern-params}
85 @aboutfun{pattern-except}
88 (defpackage :cxml-types
94 #:type-context-dependent-p
99 #:sax-validation-context-mixin
100 #:klacks-validation-context
101 #:make-klacks-validation-context
102 #:context-find-namespace-binding
)
104 "@code{cxml-types} defines an extensible interface for XML-related
105 data types as required for use in Relax NG validation.
106 It includes Relax NG's minimal built-in type library, which is named
107 @code{:||} and defines the types \"string\" and \"token\".
108 In addition, it implements the built-in types of
109 @a[http://www.w3.org/TR/xmlschema-2/]{XML Schema Datatypes}
110 as specified in @a[http://relaxng.org/xsd-20010907.html]{Guidelines for
111 using W3C XML Schema Datatypes with RELAX NG}. The XSD type library
112 is named @code{:|http://www.w3.org/2001/XMLSchema-datatypes|}.
114 @begin[Type instances]{section}
115 Each type, together with its parameters, is represented by an
116 instance of @code{data-type}. The generic function @fun{find-type},
117 defined for each library, creates type instances. A type's properties
118 are accessible using @fun{type-name}, @fun{type-library}, and
119 @fun{type-context-dependent-p}.
121 @aboutclass{datatype}
124 @aboutfun{type-library}
125 @aboutfun{type-context-dependent-p}
127 @begin[Using types]{section}
128 Types allow strings to be tested for validity and equality.
129 @fun{validp} checks whether a string can be parsed. If it is valid,
130 @fun{parse} will compute the string's @emph{value}, and return a
131 Lisp object of a type-specific class as a representation of that value.
132 Values returned by @fun{parse} can be compared for equality using
133 @fun{equal-using-type}.
137 @aboutfun{equal-using-type}
139 @begin[The validation context]{section}
140 Some types are context dependent, as indicated by
141 @fun{type-context-dependent-p}. Those type need access to state
142 computed by the XML parser implicitly, like namespace bindings or
145 An abstract class @class{validation-context} is defined.
146 Users of this API can implement a subclass of @class{validation-context}
147 and define methods for the generic functions listed below.
149 In addition, two pre-defined validation context implementations are
150 provided, one for use with SAX, the other based on Klacks.
152 @aboutclass{validation-context}
153 @aboutclass{sax-validation-context-mixin}
154 @aboutclass{klacks-validation-context}
155 @aboutfun{context-find-namespace-binding}