1 | /* |
---|
2 | * Summary: internal interfaces for XML Schemas |
---|
3 | * Description: internal interfaces for the XML Schemas handling |
---|
4 | * and schema validity checking |
---|
5 | * |
---|
6 | * Copy: See Copyright for the status of this software. |
---|
7 | * |
---|
8 | * Author: Daniel Veillard |
---|
9 | */ |
---|
10 | |
---|
11 | |
---|
12 | #ifndef __XML_SCHEMA_INTERNALS_H__ |
---|
13 | #define __XML_SCHEMA_INTERNALS_H__ |
---|
14 | |
---|
15 | #include <libxml/xmlversion.h> |
---|
16 | |
---|
17 | #ifdef LIBXML_SCHEMAS_ENABLED |
---|
18 | |
---|
19 | #include <libxml/xmlregexp.h> |
---|
20 | #include <libxml/hash.h> |
---|
21 | #include <libxml/dict.h> |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
27 | typedef enum { |
---|
28 | XML_SCHEMAS_UNKNOWN = 0, |
---|
29 | XML_SCHEMAS_STRING, |
---|
30 | XML_SCHEMAS_NORMSTRING, |
---|
31 | XML_SCHEMAS_DECIMAL, |
---|
32 | XML_SCHEMAS_TIME, |
---|
33 | XML_SCHEMAS_GDAY, |
---|
34 | XML_SCHEMAS_GMONTH, |
---|
35 | XML_SCHEMAS_GMONTHDAY, |
---|
36 | XML_SCHEMAS_GYEAR, |
---|
37 | XML_SCHEMAS_GYEARMONTH, |
---|
38 | XML_SCHEMAS_DATE, |
---|
39 | XML_SCHEMAS_DATETIME, |
---|
40 | XML_SCHEMAS_DURATION, |
---|
41 | XML_SCHEMAS_FLOAT, |
---|
42 | XML_SCHEMAS_DOUBLE, |
---|
43 | XML_SCHEMAS_BOOLEAN, |
---|
44 | XML_SCHEMAS_TOKEN, |
---|
45 | XML_SCHEMAS_LANGUAGE, |
---|
46 | XML_SCHEMAS_NMTOKEN, |
---|
47 | XML_SCHEMAS_NMTOKENS, |
---|
48 | XML_SCHEMAS_NAME, |
---|
49 | XML_SCHEMAS_QNAME, |
---|
50 | XML_SCHEMAS_NCNAME, |
---|
51 | XML_SCHEMAS_ID, |
---|
52 | XML_SCHEMAS_IDREF, |
---|
53 | XML_SCHEMAS_IDREFS, |
---|
54 | XML_SCHEMAS_ENTITY, |
---|
55 | XML_SCHEMAS_ENTITIES, |
---|
56 | XML_SCHEMAS_NOTATION, |
---|
57 | XML_SCHEMAS_ANYURI, |
---|
58 | XML_SCHEMAS_INTEGER, |
---|
59 | XML_SCHEMAS_NPINTEGER, |
---|
60 | XML_SCHEMAS_NINTEGER, |
---|
61 | XML_SCHEMAS_NNINTEGER, |
---|
62 | XML_SCHEMAS_PINTEGER, |
---|
63 | XML_SCHEMAS_INT, |
---|
64 | XML_SCHEMAS_UINT, |
---|
65 | XML_SCHEMAS_LONG, |
---|
66 | XML_SCHEMAS_ULONG, |
---|
67 | XML_SCHEMAS_SHORT, |
---|
68 | XML_SCHEMAS_USHORT, |
---|
69 | XML_SCHEMAS_BYTE, |
---|
70 | XML_SCHEMAS_UBYTE, |
---|
71 | XML_SCHEMAS_HEXBINARY, |
---|
72 | XML_SCHEMAS_BASE64BINARY, |
---|
73 | XML_SCHEMAS_ANYTYPE, |
---|
74 | XML_SCHEMAS_ANYSIMPLETYPE |
---|
75 | } xmlSchemaValType; |
---|
76 | |
---|
77 | /* |
---|
78 | * XML Schemas defines multiple type of types. |
---|
79 | */ |
---|
80 | typedef enum { |
---|
81 | XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */ |
---|
82 | XML_SCHEMA_TYPE_ANY, |
---|
83 | XML_SCHEMA_TYPE_FACET, |
---|
84 | XML_SCHEMA_TYPE_SIMPLE, |
---|
85 | XML_SCHEMA_TYPE_COMPLEX, |
---|
86 | XML_SCHEMA_TYPE_SEQUENCE, |
---|
87 | XML_SCHEMA_TYPE_CHOICE, |
---|
88 | XML_SCHEMA_TYPE_ALL, |
---|
89 | XML_SCHEMA_TYPE_SIMPLE_CONTENT, |
---|
90 | XML_SCHEMA_TYPE_COMPLEX_CONTENT, |
---|
91 | XML_SCHEMA_TYPE_UR, |
---|
92 | XML_SCHEMA_TYPE_RESTRICTION, |
---|
93 | XML_SCHEMA_TYPE_EXTENSION, |
---|
94 | XML_SCHEMA_TYPE_ELEMENT, |
---|
95 | XML_SCHEMA_TYPE_ATTRIBUTE, |
---|
96 | XML_SCHEMA_TYPE_ATTRIBUTEGROUP, |
---|
97 | XML_SCHEMA_TYPE_GROUP, |
---|
98 | XML_SCHEMA_TYPE_NOTATION, |
---|
99 | XML_SCHEMA_TYPE_LIST, |
---|
100 | XML_SCHEMA_TYPE_UNION, |
---|
101 | XML_SCHEMA_TYPE_ANY_ATTRIBUTE, |
---|
102 | XML_SCHEMA_TYPE_IDC_UNIQUE, |
---|
103 | XML_SCHEMA_TYPE_IDC_KEY, |
---|
104 | XML_SCHEMA_TYPE_IDC_KEYREF, |
---|
105 | XML_SCHEMA_TYPE_PARTICLE, |
---|
106 | XML_SCHEMA_FACET_MININCLUSIVE = 1000, |
---|
107 | XML_SCHEMA_FACET_MINEXCLUSIVE, |
---|
108 | XML_SCHEMA_FACET_MAXINCLUSIVE, |
---|
109 | XML_SCHEMA_FACET_MAXEXCLUSIVE, |
---|
110 | XML_SCHEMA_FACET_TOTALDIGITS, |
---|
111 | XML_SCHEMA_FACET_FRACTIONDIGITS, |
---|
112 | XML_SCHEMA_FACET_PATTERN, |
---|
113 | XML_SCHEMA_FACET_ENUMERATION, |
---|
114 | XML_SCHEMA_FACET_WHITESPACE, |
---|
115 | XML_SCHEMA_FACET_LENGTH, |
---|
116 | XML_SCHEMA_FACET_MAXLENGTH, |
---|
117 | XML_SCHEMA_FACET_MINLENGTH, |
---|
118 | XML_SCHEMA_EXTRA_QNAMEREF = 2000 |
---|
119 | } xmlSchemaTypeType; |
---|
120 | |
---|
121 | typedef enum { |
---|
122 | XML_SCHEMA_CONTENT_UNKNOWN = 0, |
---|
123 | XML_SCHEMA_CONTENT_EMPTY = 1, |
---|
124 | XML_SCHEMA_CONTENT_ELEMENTS, |
---|
125 | XML_SCHEMA_CONTENT_MIXED, |
---|
126 | XML_SCHEMA_CONTENT_SIMPLE, |
---|
127 | XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* obsolete, not used */ |
---|
128 | XML_SCHEMA_CONTENT_BASIC, |
---|
129 | XML_SCHEMA_CONTENT_ANY |
---|
130 | } xmlSchemaContentType; |
---|
131 | |
---|
132 | typedef struct _xmlSchemaVal xmlSchemaVal; |
---|
133 | typedef xmlSchemaVal *xmlSchemaValPtr; |
---|
134 | |
---|
135 | typedef struct _xmlSchemaType xmlSchemaType; |
---|
136 | typedef xmlSchemaType *xmlSchemaTypePtr; |
---|
137 | |
---|
138 | typedef struct _xmlSchemaFacet xmlSchemaFacet; |
---|
139 | typedef xmlSchemaFacet *xmlSchemaFacetPtr; |
---|
140 | |
---|
141 | /** |
---|
142 | * Annotation |
---|
143 | */ |
---|
144 | typedef struct _xmlSchemaAnnot xmlSchemaAnnot; |
---|
145 | typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; |
---|
146 | struct _xmlSchemaAnnot { |
---|
147 | struct _xmlSchemaAnnot *next; |
---|
148 | xmlNodePtr content; /* the annotation */ |
---|
149 | }; |
---|
150 | |
---|
151 | /** |
---|
152 | * XML_SCHEMAS_ANYATTR_SKIP: |
---|
153 | * |
---|
154 | * Skip unknown attribute from validation |
---|
155 | * Obsolete, not used anymore. |
---|
156 | */ |
---|
157 | #define XML_SCHEMAS_ANYATTR_SKIP 1 |
---|
158 | /** |
---|
159 | * XML_SCHEMAS_ANYATTR_LAX: |
---|
160 | * |
---|
161 | * Ignore validation non definition on attributes |
---|
162 | * Obsolete, not used anymore. |
---|
163 | */ |
---|
164 | #define XML_SCHEMAS_ANYATTR_LAX 2 |
---|
165 | /** |
---|
166 | * XML_SCHEMAS_ANYATTR_STRICT: |
---|
167 | * |
---|
168 | * Apply strict validation rules on attributes |
---|
169 | * Obsolete, not used anymore. |
---|
170 | */ |
---|
171 | #define XML_SCHEMAS_ANYATTR_STRICT 3 |
---|
172 | /** |
---|
173 | * XML_SCHEMAS_ANY_SKIP: |
---|
174 | * |
---|
175 | * Skip unknown attribute from validation |
---|
176 | */ |
---|
177 | #define XML_SCHEMAS_ANY_SKIP 1 |
---|
178 | /** |
---|
179 | * XML_SCHEMAS_ANY_LAX: |
---|
180 | * |
---|
181 | * Used by wildcards. |
---|
182 | * Validate if type found, don't worry if not found |
---|
183 | */ |
---|
184 | #define XML_SCHEMAS_ANY_LAX 2 |
---|
185 | /** |
---|
186 | * XML_SCHEMAS_ANY_STRICT: |
---|
187 | * |
---|
188 | * Used by wildcards. |
---|
189 | * Apply strict validation rules |
---|
190 | */ |
---|
191 | #define XML_SCHEMAS_ANY_STRICT 3 |
---|
192 | /** |
---|
193 | * XML_SCHEMAS_ATTR_USE_PROHIBITED: |
---|
194 | * |
---|
195 | * Used by wildcards. |
---|
196 | * The attribute is prohibited. |
---|
197 | */ |
---|
198 | #define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 |
---|
199 | /** |
---|
200 | * XML_SCHEMAS_ATTR_USE_REQUIRED: |
---|
201 | * |
---|
202 | * The attribute is required. |
---|
203 | */ |
---|
204 | #define XML_SCHEMAS_ATTR_USE_REQUIRED 1 |
---|
205 | /** |
---|
206 | * XML_SCHEMAS_ATTR_USE_OPTIONAL: |
---|
207 | * |
---|
208 | * The attribute is optional. |
---|
209 | */ |
---|
210 | #define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 |
---|
211 | /** |
---|
212 | * XML_SCHEMAS_ATTR_GLOBAL: |
---|
213 | * |
---|
214 | * allow elements in no namespace |
---|
215 | */ |
---|
216 | #define XML_SCHEMAS_ATTR_GLOBAL 1 << 0 |
---|
217 | /** |
---|
218 | * XML_SCHEMAS_ATTR_NSDEFAULT: |
---|
219 | * |
---|
220 | * allow elements in no namespace |
---|
221 | */ |
---|
222 | #define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 |
---|
223 | /** |
---|
224 | * XML_SCHEMAS_ATTR_INTERNAL_RESOLVED: |
---|
225 | * |
---|
226 | * this is set when the "type" and "ref" references |
---|
227 | * have been resolved. |
---|
228 | */ |
---|
229 | #define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8 |
---|
230 | /** |
---|
231 | * XML_SCHEMAS_ATTR_FIXED: |
---|
232 | * |
---|
233 | * the attribute has a fixed value |
---|
234 | */ |
---|
235 | #define XML_SCHEMAS_ATTR_FIXED 1 << 9 |
---|
236 | |
---|
237 | /** |
---|
238 | * xmlSchemaAttribute: |
---|
239 | * An attribute definition. |
---|
240 | */ |
---|
241 | |
---|
242 | typedef struct _xmlSchemaAttribute xmlSchemaAttribute; |
---|
243 | typedef xmlSchemaAttribute *xmlSchemaAttributePtr; |
---|
244 | struct _xmlSchemaAttribute { |
---|
245 | xmlSchemaTypeType type; /* The kind of type */ |
---|
246 | struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ |
---|
247 | const xmlChar *name; /* name of the declaration or empty if particle */ |
---|
248 | const xmlChar *id; |
---|
249 | const xmlChar *ref; /* the local name of the attribute decl. if a particle */ |
---|
250 | const xmlChar *refNs; /* the ns URI of the attribute decl. if a particle */ |
---|
251 | const xmlChar *typeName; /* the local name of the type definition */ |
---|
252 | const xmlChar *typeNs; /* the ns URI of the type definition */ |
---|
253 | xmlSchemaAnnotPtr annot; |
---|
254 | |
---|
255 | xmlSchemaTypePtr base; /* obsolete, not used */ |
---|
256 | int occurs; |
---|
257 | const xmlChar *defValue; |
---|
258 | xmlSchemaTypePtr subtypes; /* the type definition */ |
---|
259 | xmlNodePtr node; |
---|
260 | const xmlChar *targetNamespace; |
---|
261 | int flags; |
---|
262 | const xmlChar *refPrefix; |
---|
263 | xmlSchemaValPtr defVal; |
---|
264 | xmlSchemaAttributePtr refDecl; |
---|
265 | }; |
---|
266 | |
---|
267 | /** |
---|
268 | * xmlSchemaAttributeLink: |
---|
269 | * Used to build a list of attribute uses on complexType definitions. |
---|
270 | */ |
---|
271 | typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; |
---|
272 | typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; |
---|
273 | struct _xmlSchemaAttributeLink { |
---|
274 | struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */ |
---|
275 | struct _xmlSchemaAttribute *attr;/* the linked attribute */ |
---|
276 | }; |
---|
277 | |
---|
278 | /** |
---|
279 | * XML_SCHEMAS_WILDCARD_COMPLETE: |
---|
280 | * |
---|
281 | * If the wildcard is complete. |
---|
282 | */ |
---|
283 | #define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0 |
---|
284 | |
---|
285 | /** |
---|
286 | * xmlSchemaCharValueLink: |
---|
287 | * Used to build a list of namespaces on wildcards. |
---|
288 | */ |
---|
289 | typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; |
---|
290 | typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr; |
---|
291 | struct _xmlSchemaWildcardNs { |
---|
292 | struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */ |
---|
293 | const xmlChar *value;/* the value */ |
---|
294 | }; |
---|
295 | |
---|
296 | /** |
---|
297 | * xmlSchemaWildcard. |
---|
298 | * A wildcard. |
---|
299 | */ |
---|
300 | typedef struct _xmlSchemaWildcard xmlSchemaWildcard; |
---|
301 | typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; |
---|
302 | struct _xmlSchemaWildcard { |
---|
303 | xmlSchemaTypeType type; /* The kind of type */ |
---|
304 | const xmlChar *id; |
---|
305 | xmlSchemaAnnotPtr annot; |
---|
306 | xmlNodePtr node; |
---|
307 | int minOccurs; |
---|
308 | int maxOccurs; |
---|
309 | int processContents; |
---|
310 | int any; /* Indicates if the ns constraint is of ##any */ |
---|
311 | xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ |
---|
312 | xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */ |
---|
313 | int flags; |
---|
314 | }; |
---|
315 | |
---|
316 | /** |
---|
317 | * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: |
---|
318 | * |
---|
319 | * The attribute wildcard has been already builded. |
---|
320 | */ |
---|
321 | #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 |
---|
322 | /** |
---|
323 | * XML_SCHEMAS_ATTRGROUP_GLOBAL: |
---|
324 | * |
---|
325 | * The attribute wildcard has been already builded. |
---|
326 | */ |
---|
327 | #define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 |
---|
328 | /** |
---|
329 | * XML_SCHEMAS_ATTRGROUP_MARKED: |
---|
330 | * |
---|
331 | * Marks the attr group as marked; used for circular checks. |
---|
332 | */ |
---|
333 | #define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 |
---|
334 | |
---|
335 | /** |
---|
336 | * An attribute group definition. |
---|
337 | * |
---|
338 | * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures |
---|
339 | * must be kept similar |
---|
340 | */ |
---|
341 | typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; |
---|
342 | typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; |
---|
343 | struct _xmlSchemaAttributeGroup { |
---|
344 | xmlSchemaTypeType type; /* The kind of type */ |
---|
345 | struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ |
---|
346 | const xmlChar *name; |
---|
347 | const xmlChar *id; |
---|
348 | const xmlChar *ref; |
---|
349 | const xmlChar *refNs; |
---|
350 | xmlSchemaAnnotPtr annot; |
---|
351 | |
---|
352 | xmlSchemaAttributePtr attributes; |
---|
353 | xmlNodePtr node; |
---|
354 | int flags; |
---|
355 | xmlSchemaWildcardPtr attributeWildcard; |
---|
356 | const xmlChar *refPrefix; |
---|
357 | xmlSchemaAttributeGroupPtr refItem; /* The referenced attribute group */ |
---|
358 | const xmlChar *targetNamespace; |
---|
359 | }; |
---|
360 | |
---|
361 | /** |
---|
362 | * xmlSchemaTypeLink: |
---|
363 | * Used to build a list of types (e.g. member types of |
---|
364 | * simpleType with variety "union"). |
---|
365 | */ |
---|
366 | typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; |
---|
367 | typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; |
---|
368 | struct _xmlSchemaTypeLink { |
---|
369 | struct _xmlSchemaTypeLink *next;/* the next type link ... */ |
---|
370 | xmlSchemaTypePtr type;/* the linked type*/ |
---|
371 | }; |
---|
372 | |
---|
373 | /** |
---|
374 | * xmlSchemaFacetLink: |
---|
375 | * Used to build a list of facets. |
---|
376 | */ |
---|
377 | typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; |
---|
378 | typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr; |
---|
379 | struct _xmlSchemaFacetLink { |
---|
380 | struct _xmlSchemaFacetLink *next;/* the next facet link ... */ |
---|
381 | xmlSchemaFacetPtr facet;/* the linked facet */ |
---|
382 | }; |
---|
383 | |
---|
384 | /** |
---|
385 | * XML_SCHEMAS_TYPE_MIXED: |
---|
386 | * |
---|
387 | * the element content type is mixed |
---|
388 | */ |
---|
389 | #define XML_SCHEMAS_TYPE_MIXED 1 << 0 |
---|
390 | /** |
---|
391 | * XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION: |
---|
392 | * |
---|
393 | * the simple or complex type has a derivation method of "extension". |
---|
394 | */ |
---|
395 | #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1 |
---|
396 | /** |
---|
397 | * XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION: |
---|
398 | * |
---|
399 | * the simple or complex type has a derivation method of "restriction". |
---|
400 | */ |
---|
401 | #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2 |
---|
402 | /** |
---|
403 | * XML_SCHEMAS_TYPE_GLOBAL: |
---|
404 | * |
---|
405 | * the type is global |
---|
406 | */ |
---|
407 | #define XML_SCHEMAS_TYPE_GLOBAL 1 << 3 |
---|
408 | /** |
---|
409 | * XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD: |
---|
410 | * |
---|
411 | * the complexType owns an attribute wildcard, i.e. |
---|
412 | * it can be freed by the complexType |
---|
413 | */ |
---|
414 | #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */ |
---|
415 | /** |
---|
416 | * XML_SCHEMAS_TYPE_VARIETY_ABSENT: |
---|
417 | * |
---|
418 | * the simpleType has a variety of "absent". |
---|
419 | */ |
---|
420 | #define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 |
---|
421 | /** |
---|
422 | * XML_SCHEMAS_TYPE_VARIETY_LIST: |
---|
423 | * |
---|
424 | * the simpleType has a variety of "list". |
---|
425 | */ |
---|
426 | #define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6 |
---|
427 | /** |
---|
428 | * XML_SCHEMAS_TYPE_VARIETY_UNION: |
---|
429 | * |
---|
430 | * the simpleType has a variety of "union". |
---|
431 | */ |
---|
432 | #define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7 |
---|
433 | /** |
---|
434 | * XML_SCHEMAS_TYPE_VARIETY_ATOMIC: |
---|
435 | * |
---|
436 | * the simpleType has a variety of "union". |
---|
437 | */ |
---|
438 | #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8 |
---|
439 | /** |
---|
440 | * XML_SCHEMAS_TYPE_FINAL_EXTENSION: |
---|
441 | * |
---|
442 | * the complexType has a final of "extension". |
---|
443 | */ |
---|
444 | #define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9 |
---|
445 | /** |
---|
446 | * XML_SCHEMAS_TYPE_FINAL_RESTRICTION: |
---|
447 | * |
---|
448 | * the simpleType/complexType has a final of "restriction". |
---|
449 | */ |
---|
450 | #define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10 |
---|
451 | /** |
---|
452 | * XML_SCHEMAS_TYPE_FINAL_LIST: |
---|
453 | * |
---|
454 | * the simpleType has a final of "list". |
---|
455 | */ |
---|
456 | #define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11 |
---|
457 | /** |
---|
458 | * XML_SCHEMAS_TYPE_FINAL_UNION: |
---|
459 | * |
---|
460 | * the simpleType has a final of "union". |
---|
461 | */ |
---|
462 | #define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12 |
---|
463 | /** |
---|
464 | * XML_SCHEMAS_TYPE_FINAL_DEFAULT: |
---|
465 | * |
---|
466 | * the simpleType has a final of "default". |
---|
467 | */ |
---|
468 | #define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13 |
---|
469 | /** |
---|
470 | * XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE: |
---|
471 | * |
---|
472 | * Marks the item as a builtin primitive. |
---|
473 | */ |
---|
474 | #define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14 |
---|
475 | /** |
---|
476 | * XML_SCHEMAS_TYPE_MARKED: |
---|
477 | * |
---|
478 | * Marks the item as marked; used for circular checks. |
---|
479 | */ |
---|
480 | #define XML_SCHEMAS_TYPE_MARKED 1 << 16 |
---|
481 | /** |
---|
482 | * XML_SCHEMAS_TYPE_BLOCK_DEFAULT: |
---|
483 | * |
---|
484 | * the complexType did not specify 'block' so use the default of the |
---|
485 | * <schema> item. |
---|
486 | */ |
---|
487 | #define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17 |
---|
488 | /** |
---|
489 | * XML_SCHEMAS_TYPE_BLOCK_EXTENSION: |
---|
490 | * |
---|
491 | * the complexType has a 'block' of "extension". |
---|
492 | */ |
---|
493 | #define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18 |
---|
494 | /** |
---|
495 | * XML_SCHEMAS_TYPE_BLOCK_RESTRICTION: |
---|
496 | * |
---|
497 | * the complexType has a 'block' of "restriction". |
---|
498 | */ |
---|
499 | #define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19 |
---|
500 | /** |
---|
501 | * XML_SCHEMAS_TYPE_ABSTRACT: |
---|
502 | * |
---|
503 | * the simple/complexType is abstract. |
---|
504 | */ |
---|
505 | #define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20 |
---|
506 | /** |
---|
507 | * XML_SCHEMAS_TYPE_FACETSNEEDVALUE: |
---|
508 | * |
---|
509 | * indicates if the facets need a computed value |
---|
510 | */ |
---|
511 | #define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21 |
---|
512 | /** |
---|
513 | * XML_SCHEMAS_TYPE_INTERNAL_RESOLVED: |
---|
514 | * |
---|
515 | * indicates that the type was typefixed |
---|
516 | */ |
---|
517 | #define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22 |
---|
518 | /** |
---|
519 | * XML_SCHEMAS_TYPE_INTERNAL_INVALID: |
---|
520 | * |
---|
521 | * indicates that the type is invalid |
---|
522 | */ |
---|
523 | #define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23 |
---|
524 | |
---|
525 | |
---|
526 | /** |
---|
527 | * _xmlSchemaType: |
---|
528 | * |
---|
529 | * Schemas type definition. |
---|
530 | */ |
---|
531 | struct _xmlSchemaType { |
---|
532 | xmlSchemaTypeType type; /* The kind of type */ |
---|
533 | struct _xmlSchemaType *next;/* the next type if in a sequence ... */ |
---|
534 | const xmlChar *name; |
---|
535 | const xmlChar *id; |
---|
536 | const xmlChar *ref; |
---|
537 | const xmlChar *refNs; |
---|
538 | xmlSchemaAnnotPtr annot; |
---|
539 | xmlSchemaTypePtr subtypes; |
---|
540 | xmlSchemaAttributePtr attributes; |
---|
541 | xmlNodePtr node; |
---|
542 | int minOccurs; |
---|
543 | int maxOccurs; |
---|
544 | |
---|
545 | int flags; |
---|
546 | xmlSchemaContentType contentType; |
---|
547 | const xmlChar *base; |
---|
548 | const xmlChar *baseNs; |
---|
549 | xmlSchemaTypePtr baseType; |
---|
550 | xmlSchemaFacetPtr facets; |
---|
551 | struct _xmlSchemaType *redef;/* possible redefinitions for the type */ |
---|
552 | int recurse; |
---|
553 | xmlSchemaAttributeLinkPtr attributeUses; |
---|
554 | xmlSchemaWildcardPtr attributeWildcard; |
---|
555 | int builtInType; |
---|
556 | xmlSchemaTypeLinkPtr memberTypes; |
---|
557 | xmlSchemaFacetLinkPtr facetSet; |
---|
558 | const xmlChar *refPrefix; |
---|
559 | xmlSchemaTypePtr contentTypeDef; |
---|
560 | xmlRegexpPtr contModel; |
---|
561 | const xmlChar *targetNamespace; |
---|
562 | }; |
---|
563 | |
---|
564 | /* |
---|
565 | * xmlSchemaElement: |
---|
566 | * An element definition. |
---|
567 | * |
---|
568 | * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of |
---|
569 | * structures must be kept similar |
---|
570 | */ |
---|
571 | /** |
---|
572 | * XML_SCHEMAS_ELEM_NILLABLE: |
---|
573 | * |
---|
574 | * the element is nillable |
---|
575 | */ |
---|
576 | #define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 |
---|
577 | /** |
---|
578 | * XML_SCHEMAS_ELEM_GLOBAL: |
---|
579 | * |
---|
580 | * the element is global |
---|
581 | */ |
---|
582 | #define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 |
---|
583 | /** |
---|
584 | * XML_SCHEMAS_ELEM_DEFAULT: |
---|
585 | * |
---|
586 | * the element has a default value |
---|
587 | */ |
---|
588 | #define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 |
---|
589 | /** |
---|
590 | * XML_SCHEMAS_ELEM_FIXED: |
---|
591 | * |
---|
592 | * the element has a fixed value |
---|
593 | */ |
---|
594 | #define XML_SCHEMAS_ELEM_FIXED 1 << 3 |
---|
595 | /** |
---|
596 | * XML_SCHEMAS_ELEM_ABSTRACT: |
---|
597 | * |
---|
598 | * the element is abstract |
---|
599 | */ |
---|
600 | #define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 |
---|
601 | /** |
---|
602 | * XML_SCHEMAS_ELEM_TOPLEVEL: |
---|
603 | * |
---|
604 | * the element is top level |
---|
605 | * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead |
---|
606 | */ |
---|
607 | #define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 |
---|
608 | /** |
---|
609 | * XML_SCHEMAS_ELEM_REF: |
---|
610 | * |
---|
611 | * the element is a reference to a type |
---|
612 | */ |
---|
613 | #define XML_SCHEMAS_ELEM_REF 1 << 6 |
---|
614 | /** |
---|
615 | * XML_SCHEMAS_ELEM_NSDEFAULT: |
---|
616 | * |
---|
617 | * allow elements in no namespace |
---|
618 | * Obsolete, not used anymore. |
---|
619 | */ |
---|
620 | #define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 |
---|
621 | /** |
---|
622 | * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED: |
---|
623 | * |
---|
624 | * this is set when "type", "ref", "substitutionGroup" |
---|
625 | * references have been resolved. |
---|
626 | */ |
---|
627 | #define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8 |
---|
628 | /** |
---|
629 | * XML_SCHEMAS_ELEM_CIRCULAR: |
---|
630 | * |
---|
631 | * a helper flag for the search of circular references. |
---|
632 | */ |
---|
633 | #define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9 |
---|
634 | /** |
---|
635 | * XML_SCHEMAS_ELEM_BLOCK_ABSENT: |
---|
636 | * |
---|
637 | * the "block" attribute is absent |
---|
638 | */ |
---|
639 | #define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10 |
---|
640 | /** |
---|
641 | * XML_SCHEMAS_ELEM_BLOCK_EXTENSION: |
---|
642 | * |
---|
643 | * disallowed substitutions are absent |
---|
644 | */ |
---|
645 | #define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11 |
---|
646 | /** |
---|
647 | * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION: |
---|
648 | * |
---|
649 | * disallowed substitutions: "restriction" |
---|
650 | */ |
---|
651 | #define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12 |
---|
652 | /** |
---|
653 | * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: |
---|
654 | * |
---|
655 | * disallowed substitutions: "substituion" |
---|
656 | */ |
---|
657 | #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 |
---|
658 | /** |
---|
659 | * XML_SCHEMAS_ELEM_FINAL_ABSENT: |
---|
660 | * |
---|
661 | * substitution group exclusions are absent |
---|
662 | */ |
---|
663 | #define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14 |
---|
664 | /** |
---|
665 | * XML_SCHEMAS_ELEM_FINAL_EXTENSION: |
---|
666 | * |
---|
667 | * substitution group exclusions: "extension" |
---|
668 | */ |
---|
669 | #define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15 |
---|
670 | /** |
---|
671 | * XML_SCHEMAS_ELEM_FINAL_RESTRICTION: |
---|
672 | * |
---|
673 | * substitution group exclusions: "restriction" |
---|
674 | */ |
---|
675 | #define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16 |
---|
676 | |
---|
677 | |
---|
678 | typedef struct _xmlSchemaElement xmlSchemaElement; |
---|
679 | typedef xmlSchemaElement *xmlSchemaElementPtr; |
---|
680 | struct _xmlSchemaElement { |
---|
681 | xmlSchemaTypeType type; /* The kind of type */ |
---|
682 | struct _xmlSchemaType *next;/* the next type if in a sequence ... */ |
---|
683 | const xmlChar *name; |
---|
684 | const xmlChar *id; |
---|
685 | const xmlChar *ref; /* the local name of the element declaration if a particle */ |
---|
686 | const xmlChar *refNs; /* the ns URI of the element declaration if a particle */ |
---|
687 | xmlSchemaAnnotPtr annot; |
---|
688 | xmlSchemaTypePtr subtypes; /* the type definition */ |
---|
689 | xmlSchemaAttributePtr attributes; |
---|
690 | xmlNodePtr node; |
---|
691 | int minOccurs; |
---|
692 | int maxOccurs; |
---|
693 | |
---|
694 | int flags; |
---|
695 | const xmlChar *targetNamespace; |
---|
696 | const xmlChar *namedType; |
---|
697 | const xmlChar *namedTypeNs; |
---|
698 | const xmlChar *substGroup; |
---|
699 | const xmlChar *substGroupNs; |
---|
700 | const xmlChar *scope; |
---|
701 | const xmlChar *value; |
---|
702 | struct _xmlSchemaElement *refDecl; /* the element declaration if a particle */ |
---|
703 | xmlRegexpPtr contModel; |
---|
704 | xmlSchemaContentType contentType; |
---|
705 | const xmlChar *refPrefix; |
---|
706 | xmlSchemaValPtr defVal; |
---|
707 | void *idcs; |
---|
708 | }; |
---|
709 | |
---|
710 | /* |
---|
711 | * XML_SCHEMAS_FACET_UNKNOWN: |
---|
712 | * |
---|
713 | * unknown facet handling |
---|
714 | */ |
---|
715 | #define XML_SCHEMAS_FACET_UNKNOWN 0 |
---|
716 | /* |
---|
717 | * XML_SCHEMAS_FACET_PRESERVE: |
---|
718 | * |
---|
719 | * preserve the type of the facet |
---|
720 | */ |
---|
721 | #define XML_SCHEMAS_FACET_PRESERVE 1 |
---|
722 | /* |
---|
723 | * XML_SCHEMAS_FACET_REPLACE: |
---|
724 | * |
---|
725 | * replace the type of the facet |
---|
726 | */ |
---|
727 | #define XML_SCHEMAS_FACET_REPLACE 2 |
---|
728 | /* |
---|
729 | * XML_SCHEMAS_FACET_COLLAPSE: |
---|
730 | * |
---|
731 | * collapse the types of the facet |
---|
732 | */ |
---|
733 | #define XML_SCHEMAS_FACET_COLLAPSE 3 |
---|
734 | /** |
---|
735 | * A facet definition. |
---|
736 | */ |
---|
737 | struct _xmlSchemaFacet { |
---|
738 | xmlSchemaTypeType type; /* The kind of type */ |
---|
739 | struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ |
---|
740 | const xmlChar *value; |
---|
741 | const xmlChar *id; |
---|
742 | xmlSchemaAnnotPtr annot; |
---|
743 | xmlNodePtr node; |
---|
744 | int fixed; |
---|
745 | int whitespace; |
---|
746 | xmlSchemaValPtr val; |
---|
747 | xmlRegexpPtr regexp; |
---|
748 | }; |
---|
749 | |
---|
750 | /** |
---|
751 | * A notation definition. |
---|
752 | */ |
---|
753 | typedef struct _xmlSchemaNotation xmlSchemaNotation; |
---|
754 | typedef xmlSchemaNotation *xmlSchemaNotationPtr; |
---|
755 | struct _xmlSchemaNotation { |
---|
756 | xmlSchemaTypeType type; /* The kind of type */ |
---|
757 | const xmlChar *name; |
---|
758 | xmlSchemaAnnotPtr annot; |
---|
759 | const xmlChar *identifier; |
---|
760 | const xmlChar *targetNamespace; |
---|
761 | }; |
---|
762 | |
---|
763 | /** |
---|
764 | * XML_SCHEMAS_QUALIF_ELEM: |
---|
765 | * |
---|
766 | * the schema requires qualified elements |
---|
767 | */ |
---|
768 | #define XML_SCHEMAS_QUALIF_ELEM 1 << 0 |
---|
769 | /** |
---|
770 | * XML_SCHEMAS_QUALIF_ATTR: |
---|
771 | * |
---|
772 | * the schema requires qualified attributes |
---|
773 | */ |
---|
774 | #define XML_SCHEMAS_QUALIF_ATTR 1 << 1 |
---|
775 | /** |
---|
776 | * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION: |
---|
777 | * |
---|
778 | * the schema has "extension" in the set of finalDefault. |
---|
779 | */ |
---|
780 | #define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2 |
---|
781 | /** |
---|
782 | * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION: |
---|
783 | * |
---|
784 | * the schema has "restriction" in the set of finalDefault. |
---|
785 | */ |
---|
786 | #define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3 |
---|
787 | /** |
---|
788 | * XML_SCHEMAS_FINAL_DEFAULT_LIST: |
---|
789 | * |
---|
790 | * the cshema has "list" in the set of finalDefault. |
---|
791 | */ |
---|
792 | #define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 |
---|
793 | /** |
---|
794 | * XML_SCHEMAS_FINAL_DEFAULT_UNION: |
---|
795 | * |
---|
796 | * the schema has "union" in the set of finalDefault. |
---|
797 | */ |
---|
798 | #define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5 |
---|
799 | /** |
---|
800 | * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION: |
---|
801 | * |
---|
802 | * the schema has "extension" in the set of blockDefault. |
---|
803 | */ |
---|
804 | #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6 |
---|
805 | /** |
---|
806 | * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION: |
---|
807 | * |
---|
808 | * the schema has "restriction" in the set of blockDefault. |
---|
809 | */ |
---|
810 | #define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7 |
---|
811 | /** |
---|
812 | * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION: |
---|
813 | * |
---|
814 | * the schema has "substitution" in the set of blockDefault. |
---|
815 | */ |
---|
816 | #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8 |
---|
817 | /** |
---|
818 | * XML_SCHEMAS_INCLUDING_CONVERT_NS: |
---|
819 | * |
---|
820 | * the schema is currently including an other schema with |
---|
821 | * no target namespace. |
---|
822 | */ |
---|
823 | #define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9 |
---|
824 | /** |
---|
825 | * _xmlSchema: |
---|
826 | * |
---|
827 | * A Schemas definition |
---|
828 | */ |
---|
829 | struct _xmlSchema { |
---|
830 | const xmlChar *name; /* schema name */ |
---|
831 | const xmlChar *targetNamespace; /* the target namespace */ |
---|
832 | const xmlChar *version; |
---|
833 | const xmlChar *id; |
---|
834 | xmlDocPtr doc; |
---|
835 | xmlSchemaAnnotPtr annot; |
---|
836 | int flags; |
---|
837 | |
---|
838 | xmlHashTablePtr typeDecl; |
---|
839 | xmlHashTablePtr attrDecl; |
---|
840 | xmlHashTablePtr attrgrpDecl; |
---|
841 | xmlHashTablePtr elemDecl; |
---|
842 | xmlHashTablePtr notaDecl; |
---|
843 | |
---|
844 | xmlHashTablePtr schemasImports; |
---|
845 | |
---|
846 | void *_private; /* unused by the library for users or bindings */ |
---|
847 | xmlHashTablePtr groupDecl; |
---|
848 | xmlDictPtr dict; |
---|
849 | void *includes; /* the includes, this is opaque for now */ |
---|
850 | int preserve; /* whether to free the document */ |
---|
851 | int counter; /* used to give ononymous components unique names */ |
---|
852 | xmlHashTablePtr idcDef; |
---|
853 | void *volatiles; /* Misc. helper items (e.g. reference items) */ |
---|
854 | }; |
---|
855 | |
---|
856 | XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); |
---|
857 | XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard); |
---|
858 | |
---|
859 | #ifdef __cplusplus |
---|
860 | } |
---|
861 | #endif |
---|
862 | |
---|
863 | #endif /* LIBXML_SCHEMAS_ENABLED */ |
---|
864 | #endif /* __XML_SCHEMA_INTERNALS_H__ */ |
---|