doch ein bisschen anyuri pruefen
[cxml-rng.git] / package.lisp
blobcacc2b5a4cbffc79b6d6203ab44923f90d5fbd7a
1 (defpackage :cxml-rng
2 (:use :cl)
3 (:export #:rng-error
4 #:parsed-grammar
5 #:parse-relax-ng
6 #:serialize-grammar
7 #:make-validator)
8 (:documentation
9 "@code{cxml-rng} implements @a[http://relaxng.org/spec-20011203.html]{
10 Relax NG} schema validation for Closure XML.
12 @begin[Example]{section}
13 @begin{code}
14 (cxml:parse-file \"test.xml\"
15 (cxml-rng:make-validator
16 (cxml-rng:parse-relax-ng #p\"test.rng\")))
17 @end{code}
18 @end{section}
19 @begin[Classes]{section}
20 @aboutclass{parsed-grammar}
21 @aboutclass{rng-error}
22 @end{section}
23 @begin[Parsing and validating]{section}
24 @aboutfun{parse-relax-ng}
25 @aboutfun{make-validator}
26 @aboutfun{serialize-grammar}
27 @end{section}"))
29 (defpackage :cxml-types
30 (:use :cl)
31 (:export #:data-type
32 #:find-type
33 #:type-library
34 #:type-name
35 #:type-context-dependent-p
36 #:parse
37 #:equal-using-type
38 #:validp
39 #:validation-context
40 #:sax-validation-context-mixin
41 #:klacks-validation-context
42 #:make-klacks-validation-context
43 #:context-find-namespace-binding)
44 (:documentation
45 "@code{cxml-types} defines an extensible interface for XML-related
46 data types as required for use in Relax NG validation.
47 It includes Relax NG's minimal built-in type library, which is named
48 @code{:||} and defines the types \"string\" and \"token\".
49 In addition, it implements the built-in types of
50 @a[http://www.w3.org/TR/xmlschema-2/]{XML Schema Datatypes}
51 as specified in @a[http://relaxng.org/xsd-20010907.html]{Guidelines for
52 using W3C XML Schema Datatypes with RELAX NG}. The XSD type library
53 is named @code{:|http://www.w3.org/2001/XMLSchema-datatypes|}.
55 @begin[Type instances]{section}
56 Each type, together with its parameters, is represented by an
57 instance of @code{data-type}. The generic function @fun{find-type},
58 defined for each library, creates type instances. A type's properties
59 are accessible using @fun{type-name}, @fun{type-library}, and
60 @fun{type-context-dependent-p}.
62 @aboutclass{datatype}
63 @aboutfun{find-type}
64 @aboutfun{type-name}
65 @aboutfun{type-library}
66 @aboutfun{type-context-dependent-p}
67 @end{section}
68 @begin[Using types]{section}
69 Types allow strings to be tested for validity and equality.
70 @fun{validp} checks whether a string can be parsed. If it is valid,
71 @fun{parse} will compute the string's @emph{value}, and return a
72 Lisp object of a type-specific class as a representation of that value.
73 Values returned by @fun{parse} can be compared for equality using
74 @fun{equal-using-type}.
76 @aboutfun{validp}
77 @aboutfun{parse}
78 @aboutfun{equal-using-type}
79 @end{section}
80 @begin[The validation context]{section}
81 Some types are context dependent, as indicated by
82 @fun{type-context-dependent-p}. Those type need access to state
83 computed by the XML parser implicitly, like namespace bindings or
84 the Base URI.
86 An abstract class @class{validation-context} is defined.
87 Users of this API can implement a subclass of @class{validation-context}
88 and define methods for the generic functions listed below.
90 In addition, two pre-defined validation context implementations are
91 provided, one for use with SAX, the other based on Klacks.
93 @aboutclass{validation-context}
94 @aboutclass{sax-validation-context-mixin}
95 @aboutclass{klacks-validation-context}
96 @aboutfun{context-find-namespace-binding}
97 @end{section}"))