1      * Summary: implementation of the Relax-NG validation
2      * Description: implementation of the Relax-NG validation
3      *
4      * Copy: See Copyright for the status of this software.
5      *
6      * Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
7
8      /if not defined(XML_RELAX_NG__)
9      /define XML_RELAX_NG__
10
11      /include "libxmlrpg/xmlversion"
12      /include "libxmlrpg/hash"
13      /include "libxmlrpg/xmlstring"
14
15      /if defined(LIBXML_SCHEMAS_ENABLED)
16
17     d xmlRelaxNGPtr   s               *   based(######typedef######)
18
19      * xmlRelaxNGValidityErrorFunc:
20      * @ctx: the validation context
21      * @msg: the message
22      * @...: extra arguments
23      *
24      * Signature of an error callback from a Relax-NG validation
25
26     d xmlRelaxNGValidityErrorFunc...
27     d                 s               *   based(######typedef######)
28     d                                     procptr
29
30      * xmlRelaxNGValidityWarningFunc:
31      * @ctx: the validation context
32      * @msg: the message
33      * @...: extra arguments
34      *
35      * Signature of a warning callback from a Relax-NG validation
36
37     d xmlRelaxNGValidityWarningFunc...
38     d                 s               *   based(######typedef######)
39     d                                     procptr
40
41      * A schemas validation context
42
43     d xmlRelaxNGParserCtxtPtr...
44     d                 s               *   based(######typedef######)
45
46     d xmlRelaxNGValidCtxtPtr...
47     d                 s               *   based(######typedef######)
48
49      * xmlRelaxNGValidErr:
50      *
51      * List of possible Relax NG validation errors
52
53     d xmlRelaxNGValidErr...
54     d                 s             10i 0 based(######typedef######)           enum
55     d  XML_RELAXNG_OK...
56     d                 c                   0
57     d  XML_RELAXNG_ERR_MEMORY...
58     d                 c                   1
59     d  XML_RELAXNG_ERR_TYPE...
60     d                 c                   2
61     d  XML_RELAXNG_ERR_TYPEVAL...
62     d                 c                   3
63     d  XML_RELAXNG_ERR_DUPID...
64     d                 c                   4
65     d  XML_RELAXNG_ERR_TYPECMP...
66     d                 c                   5
67     d  XML_RELAXNG_ERR_NOSTATE...
68     d                 c                   6
69     d  XML_RELAXNG_ERR_NODEFINE...
70     d                 c                   7
71     d  XML_RELAXNG_ERR_LISTEXTRA...
72     d                 c                   8
73     d  XML_RELAXNG_ERR_LISTEMPTY...
74     d                 c                   9
75     d  XML_RELAXNG_ERR_INTERNODATA...
76     d                 c                   10
77     d  XML_RELAXNG_ERR_INTERSEQ...
78     d                 c                   11
79     d  XML_RELAXNG_ERR_INTEREXTRA...
80     d                 c                   12
81     d  XML_RELAXNG_ERR_ELEMNAME...
82     d                 c                   13
83     d  XML_RELAXNG_ERR_ATTRNAME...
84     d                 c                   14
85     d  XML_RELAXNG_ERR_ELEMNONS...
86     d                 c                   15
87     d  XML_RELAXNG_ERR_ATTRNONS...
88     d                 c                   16
89     d  XML_RELAXNG_ERR_ELEMWRONGNS...
90     d                 c                   17
91     d  XML_RELAXNG_ERR_ATTRWRONGNS...
92     d                 c                   18
93     d  XML_RELAXNG_ERR_ELEMEXTRANS...
94     d                 c                   19
95     d  XML_RELAXNG_ERR_ATTREXTRANS...
96     d                 c                   20
97     d  XML_RELAXNG_ERR_ELEMNOTEMPTY...
98     d                 c                   21
99     d  XML_RELAXNG_ERR_NOELEM...
100     d                 c                   22
101     d  XML_RELAXNG_ERR_NOTELEM...
102     d                 c                   23
103     d  XML_RELAXNG_ERR_ATTRVALID...
104     d                 c                   24
105     d  XML_RELAXNG_ERR_CONTENTVALID...
106     d                 c                   25
107     d  XML_RELAXNG_ERR_EXTRACONTENT...
108     d                 c                   26
109     d  XML_RELAXNG_ERR_INVALIDATTR...
110     d                 c                   27
111     d  XML_RELAXNG_ERR_DATAELEM...
112     d                 c                   28
113     d  XML_RELAXNG_ERR_VALELEM...
114     d                 c                   29
115     d  XML_RELAXNG_ERR_LISTELEM...
116     d                 c                   30
117     d  XML_RELAXNG_ERR_DATATYPE...
118     d                 c                   31
119     d  XML_RELAXNG_ERR_VALUE...
120     d                 c                   32
121     d  XML_RELAXNG_ERR_LIST...
122     d                 c                   33
123     d  XML_RELAXNG_ERR_NOGRAMMAR...
124     d                 c                   34
125     d  XML_RELAXNG_ERR_EXTRADATA...
126     d                 c                   35
127     d  XML_RELAXNG_ERR_LACKDATA...
128     d                 c                   36
129     d  XML_RELAXNG_ERR_INTERNAL...
130     d                 c                   37
131     d  XML_RELAXNG_ERR_ELEMWRONG...
132     d                 c                   38
133     d  XML_RELAXNG_ERR_TEXTWRONG...
134     d                 c                   39
135
136      * xmlRelaxNGParserFlags:
137      *
138      * List of possible Relax NG Parser flags
139
140     d xmlRelaxNGParserFlag...
141     d                 s             10i 0 based(######typedef######)           enum
142     d  XML_RELAXNGP_NONE...
143     d                 c                   0
144     d  XML_RELAXNGP_FREE_DOC...
145     d                 c                   1
146     d  XML_RELAXNGP_CRNG...
147     d                 c                   2
148
149     d xmlRelaxNGInitTypes...
150     d                 pr            10i 0 extproc('xmlRelaxNGInitTypes')
151
152     d xmlRelaxNGCleanupTypes...
153     d                 pr                  extproc('xmlRelaxNGCleanupTypes')
154
155
156      * Interfaces for parsing.
157
158     d xmlRelaxNGNewParserCtxt...
159     d                 pr                  extproc('xmlRelaxNGNewParserCtxt')
160     d                                     like(xmlRelaxNGParserCtxtPtr)
161     d  URL                            *   value options(*string)               const char *
162
163     d xmlRelaxNGNewMemParserCtxt...
164     d                 pr                  extproc('xmlRelaxNGNewMemParserCtxt')
165     d                                     like(xmlRelaxNGParserCtxtPtr)
166     d  buffer                         *   value options(*string)               const char *
167     d  size                         10i 0 value
168
169     d xmlRelaxNGNewDocParserCtxt...
170     d                 pr                  extproc('xmlRelaxNGNewDocParserCtxt')
171     d                                     like(xmlRelaxNGParserCtxtPtr)
172     d  doc                                value like(xmlDocPtr)
173
174     d xmlRelaxParserSetFlag...
175     d                 pr            10i 0 extproc('xmlRelaxParserSetFlag')
176     d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
177     d  flag                         10i 0 value
178
179     d xmlRelaxNGFreeParserCtxt...
180     d                 pr                  extproc('xmlRelaxNGFreeParserCtxt')
181     d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
182
183     d xmlRelaxNGSetParserErrors...
184     d                 pr                  extproc('xmlRelaxNGSetParserErrors')
185     d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
186     d  err                                value
187     d                                     like(xmlRelaxNGValidityErrorFunc)
188     d  warn                               value
189     d                                     like(xmlRelaxNGValidityWarningFunc)
190     d  ctx                            *   value                                void *
191
192     d xmlRelaxNGGetParserErrors...
193     d                 pr            10i 0 extproc('xmlRelaxNGGetParserErrors')
194     d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
195     d  err                                like(xmlRelaxNGValidityErrorFunc)
196     d  warn                               like(xmlRelaxNGValidityWarningFunc)
197     d  ctx                            *                                        void *(*)
198
199     d xmlRelaxNGSetParserStructuredErrors...
200     d                 pr                  extproc(
201     d                                     'xmlRelaxNGSetParserStructuredErrors'
202     d                                     )
203     d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
204     d  serror                             value like(xmlStructuredErrorFunc)
205     d  ctx                            *   value                                void *
206
207     d xmlRelaxNGParse...
208     d                 pr                  extproc('xmlRelaxNGParse')
209     d                                     like(xmlRelaxNGPtr)
210     d  ctxt                               value like(xmlRelaxNGParserCtxtPtr)
211
212     d xmlRelaxNGFree  pr                  extproc('xmlRelaxNGFree')
213     d  schema                             value like(xmlRelaxNGPtr)
214
215
216      /if defined(LIBXML_OUTPUT_ENABLED)
217     d xmlRelaxNGDump  pr                  extproc('xmlRelaxNGDump')
218     d  output                         *   value                                FILE *
219     d  schema                             value like(xmlRelaxNGPtr)
220
221     d xmlRelaxNGDumpTree...
222     d                 pr                  extproc('xmlRelaxNGDumpTree')
223     d  output                         *   value                                FILE *
224     d  schema                             value like(xmlRelaxNGPtr)
225      /endif                                                                    LIBXML_OUTPUT_ENABLD
226
227      * Interfaces for validating
228
229     d xmlRelaxNGSetValidErrors...
230     d                 pr                  extproc('xmlRelaxNGSetValidErrors')
231     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
232     d  err                                value
233     d                                     like(xmlRelaxNGValidityErrorFunc)
234     d  warn                               value
235     d                                     like(xmlRelaxNGValidityWarningFunc)
236     d  ctx                            *   value                                void *
237
238     d xmlRelaxNGGetValidErrors...
239     d                 pr            10i 0 extproc('xmlRelaxNGGetValidErrors')
240     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
241     d  err                                like(xmlRelaxNGValidityErrorFunc)
242     d  warn                               like(xmlRelaxNGValidityWarningFunc)
243     d  ctx                            *   value                                void * *
244
245     d xmlRelaxNGSetValidStructuredErrors...
246     d                 pr                  extproc(
247     d                                     'xmlRelaxNGSetValidStructuredErrors')
248     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
249     d  serror                             value like(xmlStructuredErrorFunc)
250     d  ctx                            *   value                                void *
251
252     d xmlRelaxNGNewValidCtxt...
253     d                 pr                  extproc('xmlRelaxNGNewValidCtxt')
254     d                                     like(xmlRelaxNGValidCtxtPtr)
255     d  schema                             value like(xmlRelaxNGPtr)
256
257     d xmlRelaxNGFreeValidCtxt...
258     d                 pr                  extproc('xmlRelaxNGFreeValidCtxt')
259     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
260
261     d xmlRelaxNGValidateDoc...
262     d                 pr            10i 0 extproc('xmlRelaxNGValidateDoc')
263     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
264     d  doc                                value like(xmlDocPtr)
265
266      * Interfaces for progressive validation when possible
267
268     d xmlRelaxNGValidatePushElement...
269     d                 pr            10i 0 extproc(
270     d                                     'xmlRelaxNGValidatePushElement')
271     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
272     d  doc                                value like(xmlDocPtr)
273     d  elem                               value like(xmlNodePtr)
274
275     d xmlRelaxNGValidatePushCData...
276     d                 pr            10i 0 extproc(
277     d                                     'xmlRelaxNGValidatePushCData')
278     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
279     d  data                           *   value options(*string)               const xmlChar *
280     d  len                          10i 0 value
281
282     d xmlRelaxNGValidatePopElement...
283     d                 pr            10i 0 extproc(
284     d                                     'xmlRelaxNGValidatePopElement')
285     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
286     d  doc                                value like(xmlDocPtr)
287     d  elem                               value like(xmlNodePtr)
288
289     d xmlRelaxNGValidateFullElement...
290     d                 pr            10i 0 extproc(
291     d                                     'xmlRelaxNGValidateFullElement')
292     d  ctxt                               value like(xmlRelaxNGValidCtxtPtr)
293     d  doc                                value like(xmlDocPtr)
294     d  elem                               value like(xmlNodePtr)
295
296      /endif                                                                    LIBXML_SCHEMAS_ENBLD
297      /endif                                                                    XML_RELAX_NG__
298