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