set eol-style:native
[reactos.git] / reactos / lib / libxml2 / include / libxml / schemasInternals.h
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 = 6,
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 = 25,
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 * XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE:
526 *
527 * a whitespace-facet value of "preserve"
528 */
529 #define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24
530 /**
531 * XML_SCHEMAS_TYPE_WHITESPACE_REPLACE:
532 *
533 * a whitespace-facet value of "replace"
534 */
535 #define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25
536 /**
537 * XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE:
538 *
539 * a whitespace-facet value of "collapse"
540 */
541 #define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26
542 /**
543 * XML_SCHEMAS_TYPE_HAS_FACETS:
544 *
545 * has facets
546 */
547 #define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27
548 /**
549 * XML_SCHEMAS_TYPE_NORMVALUENEEDED:
550 *
551 * indicates if the facets (pattern) need a normalized value
552 */
553 #define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28
554
555 /**
556 * _xmlSchemaType:
557 *
558 * Schemas type definition.
559 */
560 struct _xmlSchemaType {
561 xmlSchemaTypeType type; /* The kind of type */
562 struct _xmlSchemaType *next;/* the next type if in a sequence ... */
563 const xmlChar *name;
564 const xmlChar *id;
565 const xmlChar *ref;
566 const xmlChar *refNs;
567 xmlSchemaAnnotPtr annot;
568 xmlSchemaTypePtr subtypes;
569 xmlSchemaAttributePtr attributes;
570 xmlNodePtr node;
571 int minOccurs;
572 int maxOccurs;
573
574 int flags;
575 xmlSchemaContentType contentType;
576 const xmlChar *base;
577 const xmlChar *baseNs;
578 xmlSchemaTypePtr baseType;
579 xmlSchemaFacetPtr facets;
580 struct _xmlSchemaType *redef;/* possible redefinitions for the type */
581 int recurse;
582 xmlSchemaAttributeLinkPtr attributeUses;
583 xmlSchemaWildcardPtr attributeWildcard;
584 int builtInType;
585 xmlSchemaTypeLinkPtr memberTypes;
586 xmlSchemaFacetLinkPtr facetSet;
587 const xmlChar *refPrefix;
588 xmlSchemaTypePtr contentTypeDef;
589 xmlRegexpPtr contModel;
590 const xmlChar *targetNamespace;
591 };
592
593 /*
594 * xmlSchemaElement:
595 * An element definition.
596 *
597 * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
598 * structures must be kept similar
599 */
600 /**
601 * XML_SCHEMAS_ELEM_NILLABLE:
602 *
603 * the element is nillable
604 */
605 #define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
606 /**
607 * XML_SCHEMAS_ELEM_GLOBAL:
608 *
609 * the element is global
610 */
611 #define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
612 /**
613 * XML_SCHEMAS_ELEM_DEFAULT:
614 *
615 * the element has a default value
616 */
617 #define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
618 /**
619 * XML_SCHEMAS_ELEM_FIXED:
620 *
621 * the element has a fixed value
622 */
623 #define XML_SCHEMAS_ELEM_FIXED 1 << 3
624 /**
625 * XML_SCHEMAS_ELEM_ABSTRACT:
626 *
627 * the element is abstract
628 */
629 #define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
630 /**
631 * XML_SCHEMAS_ELEM_TOPLEVEL:
632 *
633 * the element is top level
634 * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
635 */
636 #define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
637 /**
638 * XML_SCHEMAS_ELEM_REF:
639 *
640 * the element is a reference to a type
641 */
642 #define XML_SCHEMAS_ELEM_REF 1 << 6
643 /**
644 * XML_SCHEMAS_ELEM_NSDEFAULT:
645 *
646 * allow elements in no namespace
647 * Obsolete, not used anymore.
648 */
649 #define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
650 /**
651 * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED:
652 *
653 * this is set when "type", "ref", "substitutionGroup"
654 * references have been resolved.
655 */
656 #define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
657 /**
658 * XML_SCHEMAS_ELEM_CIRCULAR:
659 *
660 * a helper flag for the search of circular references.
661 */
662 #define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
663 /**
664 * XML_SCHEMAS_ELEM_BLOCK_ABSENT:
665 *
666 * the "block" attribute is absent
667 */
668 #define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
669 /**
670 * XML_SCHEMAS_ELEM_BLOCK_EXTENSION:
671 *
672 * disallowed substitutions are absent
673 */
674 #define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
675 /**
676 * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION:
677 *
678 * disallowed substitutions: "restriction"
679 */
680 #define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
681 /**
682 * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
683 *
684 * disallowed substitutions: "substituion"
685 */
686 #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
687 /**
688 * XML_SCHEMAS_ELEM_FINAL_ABSENT:
689 *
690 * substitution group exclusions are absent
691 */
692 #define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
693 /**
694 * XML_SCHEMAS_ELEM_FINAL_EXTENSION:
695 *
696 * substitution group exclusions: "extension"
697 */
698 #define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
699 /**
700 * XML_SCHEMAS_ELEM_FINAL_RESTRICTION:
701 *
702 * substitution group exclusions: "restriction"
703 */
704 #define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
705 /**
706 * XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD:
707 *
708 * the declaration is a substitution group head
709 */
710 #define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17
711 /**
712 * XML_SCHEMAS_ELEM_INTERNAL_CHECKED:
713 *
714 * this is set when the elem decl has been checked against
715 * all constraints
716 */
717 #define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18
718
719 typedef struct _xmlSchemaElement xmlSchemaElement;
720 typedef xmlSchemaElement *xmlSchemaElementPtr;
721 struct _xmlSchemaElement {
722 xmlSchemaTypeType type; /* The kind of type */
723 struct _xmlSchemaType *next;/* the next type if in a sequence ... */
724 const xmlChar *name;
725 const xmlChar *id;
726 const xmlChar *ref; /* the local name of the element declaration if a particle */
727 const xmlChar *refNs; /* the ns URI of the element declaration if a particle */
728 xmlSchemaAnnotPtr annot;
729 xmlSchemaTypePtr subtypes; /* the type definition */
730 xmlSchemaAttributePtr attributes;
731 xmlNodePtr node;
732 int minOccurs;
733 int maxOccurs;
734
735 int flags;
736 const xmlChar *targetNamespace;
737 const xmlChar *namedType;
738 const xmlChar *namedTypeNs;
739 const xmlChar *substGroup;
740 const xmlChar *substGroupNs;
741 const xmlChar *scope;
742 const xmlChar *value;
743 struct _xmlSchemaElement *refDecl; /* This will now be used for the substitution group affiliation */
744 xmlRegexpPtr contModel;
745 xmlSchemaContentType contentType;
746 const xmlChar *refPrefix;
747 xmlSchemaValPtr defVal;
748 void *idcs;
749 };
750
751 /*
752 * XML_SCHEMAS_FACET_UNKNOWN:
753 *
754 * unknown facet handling
755 */
756 #define XML_SCHEMAS_FACET_UNKNOWN 0
757 /*
758 * XML_SCHEMAS_FACET_PRESERVE:
759 *
760 * preserve the type of the facet
761 */
762 #define XML_SCHEMAS_FACET_PRESERVE 1
763 /*
764 * XML_SCHEMAS_FACET_REPLACE:
765 *
766 * replace the type of the facet
767 */
768 #define XML_SCHEMAS_FACET_REPLACE 2
769 /*
770 * XML_SCHEMAS_FACET_COLLAPSE:
771 *
772 * collapse the types of the facet
773 */
774 #define XML_SCHEMAS_FACET_COLLAPSE 3
775 /**
776 * A facet definition.
777 */
778 struct _xmlSchemaFacet {
779 xmlSchemaTypeType type; /* The kind of type */
780 struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
781 const xmlChar *value;
782 const xmlChar *id;
783 xmlSchemaAnnotPtr annot;
784 xmlNodePtr node;
785 int fixed;
786 int whitespace;
787 xmlSchemaValPtr val;
788 xmlRegexpPtr regexp;
789 };
790
791 /**
792 * A notation definition.
793 */
794 typedef struct _xmlSchemaNotation xmlSchemaNotation;
795 typedef xmlSchemaNotation *xmlSchemaNotationPtr;
796 struct _xmlSchemaNotation {
797 xmlSchemaTypeType type; /* The kind of type */
798 const xmlChar *name;
799 xmlSchemaAnnotPtr annot;
800 const xmlChar *identifier;
801 const xmlChar *targetNamespace;
802 };
803
804 /**
805 * XML_SCHEMAS_QUALIF_ELEM:
806 *
807 * the schema requires qualified elements
808 */
809 #define XML_SCHEMAS_QUALIF_ELEM 1 << 0
810 /**
811 * XML_SCHEMAS_QUALIF_ATTR:
812 *
813 * the schema requires qualified attributes
814 */
815 #define XML_SCHEMAS_QUALIF_ATTR 1 << 1
816 /**
817 * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION:
818 *
819 * the schema has "extension" in the set of finalDefault.
820 */
821 #define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
822 /**
823 * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION:
824 *
825 * the schema has "restriction" in the set of finalDefault.
826 */
827 #define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
828 /**
829 * XML_SCHEMAS_FINAL_DEFAULT_LIST:
830 *
831 * the cshema has "list" in the set of finalDefault.
832 */
833 #define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
834 /**
835 * XML_SCHEMAS_FINAL_DEFAULT_UNION:
836 *
837 * the schema has "union" in the set of finalDefault.
838 */
839 #define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
840 /**
841 * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION:
842 *
843 * the schema has "extension" in the set of blockDefault.
844 */
845 #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
846 /**
847 * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION:
848 *
849 * the schema has "restriction" in the set of blockDefault.
850 */
851 #define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
852 /**
853 * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION:
854 *
855 * the schema has "substitution" in the set of blockDefault.
856 */
857 #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
858 /**
859 * XML_SCHEMAS_INCLUDING_CONVERT_NS:
860 *
861 * the schema is currently including an other schema with
862 * no target namespace.
863 */
864 #define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
865 /**
866 * _xmlSchema:
867 *
868 * A Schemas definition
869 */
870 struct _xmlSchema {
871 const xmlChar *name; /* schema name */
872 const xmlChar *targetNamespace; /* the target namespace */
873 const xmlChar *version;
874 const xmlChar *id;
875 xmlDocPtr doc;
876 xmlSchemaAnnotPtr annot;
877 int flags;
878
879 xmlHashTablePtr typeDecl;
880 xmlHashTablePtr attrDecl;
881 xmlHashTablePtr attrgrpDecl;
882 xmlHashTablePtr elemDecl;
883 xmlHashTablePtr notaDecl;
884
885 xmlHashTablePtr schemasImports;
886
887 void *_private; /* unused by the library for users or bindings */
888 xmlHashTablePtr groupDecl;
889 xmlDictPtr dict;
890 void *includes; /* the includes, this is opaque for now */
891 int preserve; /* whether to free the document */
892 int counter; /* used to give ononymous components unique names */
893 xmlHashTablePtr idcDef;
894 void *volatiles; /* Misc. helper items (e.g. reference items) */
895 };
896
897 XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
898 XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
899
900 #ifdef __cplusplus
901 }
902 #endif
903
904 #endif /* LIBXML_SCHEMAS_ENABLED */
905 #endif /* __XML_SCHEMA_INTERNALS_H__ */