Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 09:14:45

0001 /**
0002  * @file
0003  * 
0004  * @brief internal interfaces for XML Schemas
0005  * 
0006  * internal interfaces for the XML Schemas handling
0007  *              and schema validity checking
0008  *      The Schemas development is a Work In Progress.
0009  *              Some of those interfaces are not guaranteed to be API or ABI stable !
0010  *
0011  * @copyright See Copyright for the status of this software.
0012  *
0013  * @author Daniel Veillard
0014  */
0015 
0016 
0017 #ifndef __XML_SCHEMA_INTERNALS_H__
0018 #define __XML_SCHEMA_INTERNALS_H__
0019 
0020 #include <libxml/xmlversion.h>
0021 
0022 #ifdef LIBXML_SCHEMAS_ENABLED
0023 
0024 #include <libxml/xmlregexp.h>
0025 #include <libxml/hash.h>
0026 #include <libxml/dict.h>
0027 #include <libxml/tree.h>
0028 
0029 #ifdef __cplusplus
0030 extern "C" {
0031 #endif
0032 
0033 /**
0034  * Schema value type
0035  */
0036 typedef enum {
0037     XML_SCHEMAS_UNKNOWN = 0,
0038     XML_SCHEMAS_STRING = 1,
0039     XML_SCHEMAS_NORMSTRING = 2,
0040     XML_SCHEMAS_DECIMAL = 3,
0041     XML_SCHEMAS_TIME = 4,
0042     XML_SCHEMAS_GDAY = 5,
0043     XML_SCHEMAS_GMONTH = 6,
0044     XML_SCHEMAS_GMONTHDAY = 7,
0045     XML_SCHEMAS_GYEAR = 8,
0046     XML_SCHEMAS_GYEARMONTH = 9,
0047     XML_SCHEMAS_DATE = 10,
0048     XML_SCHEMAS_DATETIME = 11,
0049     XML_SCHEMAS_DURATION = 12,
0050     XML_SCHEMAS_FLOAT = 13,
0051     XML_SCHEMAS_DOUBLE = 14,
0052     XML_SCHEMAS_BOOLEAN = 15,
0053     XML_SCHEMAS_TOKEN = 16,
0054     XML_SCHEMAS_LANGUAGE = 17,
0055     XML_SCHEMAS_NMTOKEN = 18,
0056     XML_SCHEMAS_NMTOKENS = 19,
0057     XML_SCHEMAS_NAME = 20,
0058     XML_SCHEMAS_QNAME = 21,
0059     XML_SCHEMAS_NCNAME = 22,
0060     XML_SCHEMAS_ID = 23,
0061     XML_SCHEMAS_IDREF = 24,
0062     XML_SCHEMAS_IDREFS = 25,
0063     XML_SCHEMAS_ENTITY = 26,
0064     XML_SCHEMAS_ENTITIES = 27,
0065     XML_SCHEMAS_NOTATION = 28,
0066     XML_SCHEMAS_ANYURI = 29,
0067     XML_SCHEMAS_INTEGER = 30,
0068     XML_SCHEMAS_NPINTEGER = 31,
0069     XML_SCHEMAS_NINTEGER = 32,
0070     XML_SCHEMAS_NNINTEGER = 33,
0071     XML_SCHEMAS_PINTEGER = 34,
0072     XML_SCHEMAS_INT = 35,
0073     XML_SCHEMAS_UINT = 36,
0074     XML_SCHEMAS_LONG = 37,
0075     XML_SCHEMAS_ULONG = 38,
0076     XML_SCHEMAS_SHORT = 39,
0077     XML_SCHEMAS_USHORT = 40,
0078     XML_SCHEMAS_BYTE = 41,
0079     XML_SCHEMAS_UBYTE = 42,
0080     XML_SCHEMAS_HEXBINARY = 43,
0081     XML_SCHEMAS_BASE64BINARY = 44,
0082     XML_SCHEMAS_ANYTYPE = 45,
0083     XML_SCHEMAS_ANYSIMPLETYPE = 46
0084 } xmlSchemaValType;
0085 
0086 /**
0087  * XML Schemas defines multiple type of types.
0088  */
0089 typedef enum {
0090     XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */
0091     XML_SCHEMA_TYPE_ANY,
0092     XML_SCHEMA_TYPE_FACET,
0093     XML_SCHEMA_TYPE_SIMPLE,
0094     XML_SCHEMA_TYPE_COMPLEX,
0095     XML_SCHEMA_TYPE_SEQUENCE = 6,
0096     XML_SCHEMA_TYPE_CHOICE,
0097     XML_SCHEMA_TYPE_ALL,
0098     XML_SCHEMA_TYPE_SIMPLE_CONTENT,
0099     XML_SCHEMA_TYPE_COMPLEX_CONTENT,
0100     XML_SCHEMA_TYPE_UR,
0101     XML_SCHEMA_TYPE_RESTRICTION,
0102     XML_SCHEMA_TYPE_EXTENSION,
0103     XML_SCHEMA_TYPE_ELEMENT,
0104     XML_SCHEMA_TYPE_ATTRIBUTE,
0105     XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
0106     XML_SCHEMA_TYPE_GROUP,
0107     XML_SCHEMA_TYPE_NOTATION,
0108     XML_SCHEMA_TYPE_LIST,
0109     XML_SCHEMA_TYPE_UNION,
0110     XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
0111     XML_SCHEMA_TYPE_IDC_UNIQUE,
0112     XML_SCHEMA_TYPE_IDC_KEY,
0113     XML_SCHEMA_TYPE_IDC_KEYREF,
0114     XML_SCHEMA_TYPE_PARTICLE = 25,
0115     XML_SCHEMA_TYPE_ATTRIBUTE_USE,
0116     XML_SCHEMA_FACET_MININCLUSIVE = 1000,
0117     XML_SCHEMA_FACET_MINEXCLUSIVE,
0118     XML_SCHEMA_FACET_MAXINCLUSIVE,
0119     XML_SCHEMA_FACET_MAXEXCLUSIVE,
0120     XML_SCHEMA_FACET_TOTALDIGITS,
0121     XML_SCHEMA_FACET_FRACTIONDIGITS,
0122     XML_SCHEMA_FACET_PATTERN,
0123     XML_SCHEMA_FACET_ENUMERATION,
0124     XML_SCHEMA_FACET_WHITESPACE,
0125     XML_SCHEMA_FACET_LENGTH,
0126     XML_SCHEMA_FACET_MAXLENGTH,
0127     XML_SCHEMA_FACET_MINLENGTH,
0128     XML_SCHEMA_EXTRA_QNAMEREF = 2000,
0129     XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
0130 } xmlSchemaTypeType;
0131 
0132 /**
0133  * Schema content type
0134  */
0135 typedef enum {
0136     XML_SCHEMA_CONTENT_UNKNOWN = 0,
0137     XML_SCHEMA_CONTENT_EMPTY = 1,
0138     XML_SCHEMA_CONTENT_ELEMENTS,
0139     XML_SCHEMA_CONTENT_MIXED,
0140     XML_SCHEMA_CONTENT_SIMPLE,
0141     XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */
0142     XML_SCHEMA_CONTENT_BASIC,
0143     XML_SCHEMA_CONTENT_ANY
0144 } xmlSchemaContentType;
0145 
0146 /** Schema value */
0147 typedef struct _xmlSchemaVal xmlSchemaVal;
0148 typedef xmlSchemaVal *xmlSchemaValPtr;
0149 
0150 /** Schema type */
0151 typedef struct _xmlSchemaType xmlSchemaType;
0152 typedef xmlSchemaType *xmlSchemaTypePtr;
0153 
0154 /** Schema facet */
0155 typedef struct _xmlSchemaFacet xmlSchemaFacet;
0156 typedef xmlSchemaFacet *xmlSchemaFacetPtr;
0157 
0158 /** Schema annotation */
0159 typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
0160 typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
0161 /**
0162  * Annotation
0163  */
0164 struct _xmlSchemaAnnot {
0165     struct _xmlSchemaAnnot *next;
0166     xmlNode *content;         /* the annotation */
0167 };
0168 
0169 /**
0170  * Skip unknown attribute from validation
0171  * Obsolete, not used anymore.
0172  */
0173 #define XML_SCHEMAS_ANYATTR_SKIP        1
0174 /**
0175  * Ignore validation non definition on attributes
0176  * Obsolete, not used anymore.
0177  */
0178 #define XML_SCHEMAS_ANYATTR_LAX                2
0179 /**
0180  * Apply strict validation rules on attributes
0181  * Obsolete, not used anymore.
0182  */
0183 #define XML_SCHEMAS_ANYATTR_STRICT        3
0184 /**
0185  * Skip unknown attribute from validation
0186  */
0187 #define XML_SCHEMAS_ANY_SKIP        1
0188 /**
0189  * Used by wildcards.
0190  * Validate if type found, don't worry if not found
0191  */
0192 #define XML_SCHEMAS_ANY_LAX                2
0193 /**
0194  * Used by wildcards.
0195  * Apply strict validation rules
0196  */
0197 #define XML_SCHEMAS_ANY_STRICT        3
0198 /**
0199  * Used by wildcards.
0200  * The attribute is prohibited.
0201  */
0202 #define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
0203 /**
0204  * The attribute is required.
0205  */
0206 #define XML_SCHEMAS_ATTR_USE_REQUIRED 1
0207 /**
0208  * The attribute is optional.
0209  */
0210 #define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
0211 /**
0212  * allow elements in no namespace
0213  */
0214 #define XML_SCHEMAS_ATTR_GLOBAL        1 << 0
0215 /**
0216  * allow elements in no namespace
0217  */
0218 #define XML_SCHEMAS_ATTR_NSDEFAULT        1 << 7
0219 /**
0220  * this is set when the "type" and "ref" references
0221  * have been resolved.
0222  */
0223 #define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED        1 << 8
0224 /**
0225  * the attribute has a fixed value
0226  */
0227 #define XML_SCHEMAS_ATTR_FIXED        1 << 9
0228 
0229 /** Schema attribute definition */
0230 typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
0231 typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
0232 /**
0233  * An attribute definition.
0234  */
0235 struct _xmlSchemaAttribute {
0236     xmlSchemaTypeType type;
0237     struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */
0238     const xmlChar *name; /* the name of the declaration */
0239     const xmlChar *id; /* Deprecated; not used */
0240     const xmlChar *ref; /* Deprecated; not used */
0241     const xmlChar *refNs; /* Deprecated; not used */
0242     const xmlChar *typeName; /* the local name of the type definition */
0243     const xmlChar *typeNs; /* the ns URI of the type definition */
0244     xmlSchemaAnnot *annot;
0245 
0246     xmlSchemaType *base; /* Deprecated; not used */
0247     int occurs; /* Deprecated; not used */
0248     const xmlChar *defValue; /* The initial value of the value constraint */
0249     xmlSchemaType *subtypes; /* the type definition */
0250     xmlNode *node;
0251     const xmlChar *targetNamespace;
0252     int flags;
0253     const xmlChar *refPrefix; /* Deprecated; not used */
0254     xmlSchemaVal *defVal; /* The compiled value constraint */
0255     xmlSchemaAttribute *refDecl; /* Deprecated; not used */
0256 };
0257 
0258 /** Linked list of schema attributes */
0259 typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
0260 typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
0261 /**
0262  * Used to build a list of attribute uses on complexType definitions.
0263  * WARNING: Deprecated; not used.
0264  */
0265 struct _xmlSchemaAttributeLink {
0266     struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
0267     struct _xmlSchemaAttribute *attr;/* the linked attribute */
0268 };
0269 
0270 /**
0271  * If the wildcard is complete.
0272  */
0273 #define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
0274 
0275 /** Namespace wildcard */
0276 typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
0277 typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
0278 /**
0279  * Used to build a list of namespaces on wildcards.
0280  */
0281 struct _xmlSchemaWildcardNs {
0282     struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
0283     const xmlChar *value;/* the value */
0284 };
0285 
0286 /** Name wildcard */
0287 typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
0288 typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
0289 /**
0290  * A wildcard.
0291  */
0292 struct _xmlSchemaWildcard {
0293     xmlSchemaTypeType type;        /* The kind of type */
0294     const xmlChar *id; /* Deprecated; not used */
0295     xmlSchemaAnnot *annot;
0296     xmlNode *node;
0297     int minOccurs; /* Deprecated; not used */
0298     int maxOccurs; /* Deprecated; not used */
0299     int processContents;
0300     int any; /* Indicates if the ns constraint is of ##any */
0301     xmlSchemaWildcardNs *nsSet; /* The list of allowed namespaces */
0302     xmlSchemaWildcardNs *negNsSet; /* The negated namespace */
0303     int flags;
0304 };
0305 
0306 /**
0307  * The attribute wildcard has been built.
0308  */
0309 #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
0310 /**
0311  * The attribute group has been defined.
0312  */
0313 #define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
0314 /**
0315  * Marks the attr group as marked; used for circular checks.
0316  */
0317 #define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
0318 
0319 /**
0320  * The attr group was redefined.
0321  */
0322 #define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
0323 /**
0324  * Whether this attr. group contains attr. group references.
0325  */
0326 #define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
0327 
0328 /** Attribute group */
0329 typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
0330 typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
0331 /**
0332  * An attribute group definition.
0333  *
0334  * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
0335  * must be kept similar
0336  */
0337 struct _xmlSchemaAttributeGroup {
0338     xmlSchemaTypeType type;        /* The kind of type */
0339     struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
0340     const xmlChar *name;
0341     const xmlChar *id;
0342     const xmlChar *ref; /* Deprecated; not used */
0343     const xmlChar *refNs; /* Deprecated; not used */
0344     xmlSchemaAnnot *annot;
0345 
0346     xmlSchemaAttribute *attributes; /* Deprecated; not used */
0347     xmlNode *node;
0348     int flags;
0349     xmlSchemaWildcard *attributeWildcard;
0350     const xmlChar *refPrefix; /* Deprecated; not used */
0351     xmlSchemaAttributeGroup *refItem; /* Deprecated; not used */
0352     const xmlChar *targetNamespace;
0353     void *attrUses;
0354 };
0355 
0356 /** Linked list of schema types */
0357 typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
0358 typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
0359 /**
0360  * Used to build a list of types (e.g. member types of
0361  * simpleType with variety "union").
0362  */
0363 struct _xmlSchemaTypeLink {
0364     struct _xmlSchemaTypeLink *next;/* the next type link ... */
0365     xmlSchemaType *type;/* the linked type */
0366 };
0367 
0368 /** Linked list of schema facets */
0369 typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
0370 typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
0371 /**
0372  * Used to build a list of facets.
0373  */
0374 struct _xmlSchemaFacetLink {
0375     struct _xmlSchemaFacetLink *next;/* the next facet link ... */
0376     xmlSchemaFacet *facet;/* the linked facet */
0377 };
0378 
0379 /**
0380  * the element content type is mixed
0381  */
0382 #define XML_SCHEMAS_TYPE_MIXED                1 << 0
0383 /**
0384  * the simple or complex type has a derivation method of "extension".
0385  */
0386 #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION                1 << 1
0387 /**
0388  * the simple or complex type has a derivation method of "restriction".
0389  */
0390 #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION                1 << 2
0391 /**
0392  * the type is global
0393  */
0394 #define XML_SCHEMAS_TYPE_GLOBAL                1 << 3
0395 /**
0396  * the complexType owns an attribute wildcard, i.e.
0397  * it can be freed by the complexType
0398  */
0399 #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD    1 << 4 /* Obsolete. */
0400 /**
0401  * the simpleType has a variety of "absent".
0402  * TODO: Actually not necessary :-/, since if
0403  * none of the variety flags occur then it's
0404  * automatically absent.
0405  */
0406 #define XML_SCHEMAS_TYPE_VARIETY_ABSENT    1 << 5
0407 /**
0408  * the simpleType has a variety of "list".
0409  */
0410 #define XML_SCHEMAS_TYPE_VARIETY_LIST    1 << 6
0411 /**
0412  * the simpleType has a variety of "union".
0413  */
0414 #define XML_SCHEMAS_TYPE_VARIETY_UNION    1 << 7
0415 /**
0416  * the simpleType has a variety of "union".
0417  */
0418 #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC    1 << 8
0419 /**
0420  * the complexType has a final of "extension".
0421  */
0422 #define XML_SCHEMAS_TYPE_FINAL_EXTENSION    1 << 9
0423 /**
0424  * the simpleType/complexType has a final of "restriction".
0425  */
0426 #define XML_SCHEMAS_TYPE_FINAL_RESTRICTION    1 << 10
0427 /**
0428  * the simpleType has a final of "list".
0429  */
0430 #define XML_SCHEMAS_TYPE_FINAL_LIST    1 << 11
0431 /**
0432  * the simpleType has a final of "union".
0433  */
0434 #define XML_SCHEMAS_TYPE_FINAL_UNION    1 << 12
0435 /**
0436  * the simpleType has a final of "default".
0437  */
0438 #define XML_SCHEMAS_TYPE_FINAL_DEFAULT    1 << 13
0439 /**
0440  * Marks the item as a builtin primitive.
0441  */
0442 #define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE    1 << 14
0443 /**
0444  * Marks the item as marked; used for circular checks.
0445  */
0446 #define XML_SCHEMAS_TYPE_MARKED        1 << 16
0447 /**
0448  * the complexType did not specify 'block' so use the default of the
0449  * `<schema>` item.
0450  */
0451 #define XML_SCHEMAS_TYPE_BLOCK_DEFAULT    1 << 17
0452 /**
0453  * the complexType has a 'block' of "extension".
0454  */
0455 #define XML_SCHEMAS_TYPE_BLOCK_EXTENSION    1 << 18
0456 /**
0457  * the complexType has a 'block' of "restriction".
0458  */
0459 #define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION    1 << 19
0460 /**
0461  * the simple/complexType is abstract.
0462  */
0463 #define XML_SCHEMAS_TYPE_ABSTRACT    1 << 20
0464 /**
0465  * indicates if the facets need a computed value
0466  */
0467 #define XML_SCHEMAS_TYPE_FACETSNEEDVALUE    1 << 21
0468 /**
0469  * indicates that the type was typefixed
0470  */
0471 #define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED    1 << 22
0472 /**
0473  * indicates that the type is invalid
0474  */
0475 #define XML_SCHEMAS_TYPE_INTERNAL_INVALID    1 << 23
0476 /**
0477  * a whitespace-facet value of "preserve"
0478  */
0479 #define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE    1 << 24
0480 /**
0481  * a whitespace-facet value of "replace"
0482  */
0483 #define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE    1 << 25
0484 /**
0485  * a whitespace-facet value of "collapse"
0486  */
0487 #define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE    1 << 26
0488 /**
0489  * has facets
0490  */
0491 #define XML_SCHEMAS_TYPE_HAS_FACETS    1 << 27
0492 /**
0493  * indicates if the facets (pattern) need a normalized value
0494  */
0495 #define XML_SCHEMAS_TYPE_NORMVALUENEEDED    1 << 28
0496 
0497 /**
0498  * First stage of fixup was done.
0499  */
0500 #define XML_SCHEMAS_TYPE_FIXUP_1    1 << 29
0501 
0502 /**
0503  * The type was redefined.
0504  */
0505 #define XML_SCHEMAS_TYPE_REDEFINED    1 << 30
0506 #if 0
0507 /**
0508  * The type redefines an other type.
0509  */
0510 #define XML_SCHEMAS_TYPE_REDEFINING    1 << 31
0511 #endif
0512 
0513 /**
0514  * Schemas type definition.
0515  */
0516 struct _xmlSchemaType {
0517     xmlSchemaTypeType type; /* The kind of type */
0518     struct _xmlSchemaType *next; /* the next type if in a sequence ... */
0519     const xmlChar *name;
0520     const xmlChar *id ; /* Deprecated; not used */
0521     const xmlChar *ref; /* Deprecated; not used */
0522     const xmlChar *refNs; /* Deprecated; not used */
0523     xmlSchemaAnnot *annot;
0524     xmlSchemaType *subtypes;
0525     xmlSchemaAttribute *attributes; /* Deprecated; not used */
0526     xmlNode *node;
0527     int minOccurs; /* Deprecated; not used */
0528     int maxOccurs; /* Deprecated; not used */
0529 
0530     int flags;
0531     xmlSchemaContentType contentType;
0532     const xmlChar *base; /* Base type's local name */
0533     const xmlChar *baseNs; /* Base type's target namespace */
0534     xmlSchemaType *baseType; /* The base type component */
0535     xmlSchemaFacet *facets; /* Local facets */
0536     struct _xmlSchemaType *redef; /* Deprecated; not used */
0537     int recurse; /* Obsolete */
0538     xmlSchemaAttributeLink **attributeUses; /* Deprecated; not used */
0539     xmlSchemaWildcard *attributeWildcard;
0540     int builtInType; /* Type of built-in types. */
0541     xmlSchemaTypeLink *memberTypes; /* member-types if a union type. */
0542     xmlSchemaFacetLink *facetSet; /* All facets (incl. inherited) */
0543     const xmlChar *refPrefix; /* Deprecated; not used */
0544     xmlSchemaType *contentTypeDef; /* Used for the simple content of complex types.
0545                                         Could we use @subtypes for this? */
0546     xmlRegexp *contModel; /* Holds the automaton of the content model */
0547     const xmlChar *targetNamespace;
0548     void *attrUses;
0549 };
0550 
0551 /**
0552  * the element is nillable
0553  */
0554 #define XML_SCHEMAS_ELEM_NILLABLE        1 << 0
0555 /**
0556  * the element is global
0557  */
0558 #define XML_SCHEMAS_ELEM_GLOBAL                1 << 1
0559 /**
0560  * the element has a default value
0561  */
0562 #define XML_SCHEMAS_ELEM_DEFAULT        1 << 2
0563 /**
0564  * the element has a fixed value
0565  */
0566 #define XML_SCHEMAS_ELEM_FIXED                1 << 3
0567 /**
0568  * the element is abstract
0569  */
0570 #define XML_SCHEMAS_ELEM_ABSTRACT        1 << 4
0571 /**
0572  * the element is top level
0573  * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
0574  */
0575 #define XML_SCHEMAS_ELEM_TOPLEVEL        1 << 5
0576 /**
0577  * the element is a reference to a type
0578  */
0579 #define XML_SCHEMAS_ELEM_REF                1 << 6
0580 /**
0581  * allow elements in no namespace
0582  * Obsolete, not used anymore.
0583  */
0584 #define XML_SCHEMAS_ELEM_NSDEFAULT        1 << 7
0585 /**
0586  * this is set when "type", "ref", "substitutionGroup"
0587  * references have been resolved.
0588  */
0589 #define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED        1 << 8
0590  /**
0591  * a helper flag for the search of circular references.
0592  */
0593 #define XML_SCHEMAS_ELEM_CIRCULAR        1 << 9
0594 /**
0595  * the "block" attribute is absent
0596  */
0597 #define XML_SCHEMAS_ELEM_BLOCK_ABSENT        1 << 10
0598 /**
0599  * disallowed substitutions are absent
0600  */
0601 #define XML_SCHEMAS_ELEM_BLOCK_EXTENSION        1 << 11
0602 /**
0603  * disallowed substitutions: "restriction"
0604  */
0605 #define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION        1 << 12
0606 /**
0607  * disallowed substitutions: "substitution"
0608  */
0609 #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION        1 << 13
0610 /**
0611  * substitution group exclusions are absent
0612  */
0613 #define XML_SCHEMAS_ELEM_FINAL_ABSENT        1 << 14
0614 /**
0615  * substitution group exclusions: "extension"
0616  */
0617 #define XML_SCHEMAS_ELEM_FINAL_EXTENSION        1 << 15
0618 /**
0619  * substitution group exclusions: "restriction"
0620  */
0621 #define XML_SCHEMAS_ELEM_FINAL_RESTRICTION        1 << 16
0622 /**
0623  * the declaration is a substitution group head
0624  */
0625 #define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD        1 << 17
0626 /**
0627  * this is set when the elem decl has been checked against
0628  * all constraints
0629  */
0630 #define XML_SCHEMAS_ELEM_INTERNAL_CHECKED        1 << 18
0631 
0632 /** Schema element definition */
0633 typedef struct _xmlSchemaElement xmlSchemaElement;
0634 typedef xmlSchemaElement *xmlSchemaElementPtr;
0635 /**
0636  * An element definition.
0637  *
0638  * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
0639  * structures must be kept similar
0640  */
0641 struct _xmlSchemaElement {
0642     xmlSchemaTypeType type; /* The kind of type */
0643     struct _xmlSchemaType *next; /* Not used? */
0644     const xmlChar *name;
0645     const xmlChar *id; /* Deprecated; not used */
0646     const xmlChar *ref; /* Deprecated; not used */
0647     const xmlChar *refNs; /* Deprecated; not used */
0648     xmlSchemaAnnot *annot;
0649     xmlSchemaType *subtypes; /* the type definition */
0650     xmlSchemaAttribute *attributes;
0651     xmlNode *node;
0652     int minOccurs; /* Deprecated; not used */
0653     int maxOccurs; /* Deprecated; not used */
0654 
0655     int flags;
0656     const xmlChar *targetNamespace;
0657     const xmlChar *namedType;
0658     const xmlChar *namedTypeNs;
0659     const xmlChar *substGroup;
0660     const xmlChar *substGroupNs;
0661     const xmlChar *scope;
0662     const xmlChar *value; /* The original value of the value constraint. */
0663     struct _xmlSchemaElement *refDecl; /* This will now be used for the
0664                                           substitution group affiliation */
0665     xmlRegexp *contModel; /* Obsolete for WXS, maybe used for RelaxNG */
0666     xmlSchemaContentType contentType;
0667     const xmlChar *refPrefix; /* Deprecated; not used */
0668     xmlSchemaVal *defVal; /* The compiled value constraint. */
0669     void *idcs; /* The identity-constraint defs */
0670 };
0671 
0672 /**
0673  * unknown facet handling
0674  */
0675 #define XML_SCHEMAS_FACET_UNKNOWN        0
0676 /**
0677  * preserve the type of the facet
0678  */
0679 #define XML_SCHEMAS_FACET_PRESERVE        1
0680 /**
0681  * replace the type of the facet
0682  */
0683 #define XML_SCHEMAS_FACET_REPLACE        2
0684 /**
0685  * collapse the types of the facet
0686  */
0687 #define XML_SCHEMAS_FACET_COLLAPSE        3
0688 /**
0689  * A facet definition.
0690  */
0691 struct _xmlSchemaFacet {
0692     xmlSchemaTypeType type;        /* The kind of type */
0693     struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
0694     const xmlChar *value; /* The original value */
0695     const xmlChar *id; /* Obsolete */
0696     xmlSchemaAnnot *annot;
0697     xmlNode *node;
0698     int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
0699     int whitespace;
0700     xmlSchemaVal *val; /* The compiled value */
0701     xmlRegexp      *regexp; /* The regex for patterns */
0702 };
0703 
0704 /** Schema notation */
0705 typedef struct _xmlSchemaNotation xmlSchemaNotation;
0706 typedef xmlSchemaNotation *xmlSchemaNotationPtr;
0707 /**
0708  * A notation definition.
0709  */
0710 struct _xmlSchemaNotation {
0711     xmlSchemaTypeType type; /* The kind of type */
0712     const xmlChar *name;
0713     xmlSchemaAnnot *annot;
0714     const xmlChar *identifier;
0715     const xmlChar *targetNamespace;
0716 };
0717 
0718 /*
0719 * TODO: Actually all those flags used for the schema should sit
0720 * on the schema parser context, since they are used only
0721 * during parsing an XML schema document, and not available
0722 * on the component level as per spec.
0723 */
0724 /**
0725  * Reflects elementFormDefault == qualified in
0726  * an XML schema document.
0727  */
0728 #define XML_SCHEMAS_QUALIF_ELEM                1 << 0
0729 /**
0730  * Reflects attributeFormDefault == qualified in
0731  * an XML schema document.
0732  */
0733 #define XML_SCHEMAS_QUALIF_ATTR            1 << 1
0734 /**
0735  * the schema has "extension" in the set of finalDefault.
0736  */
0737 #define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION        1 << 2
0738 /**
0739  * the schema has "restriction" in the set of finalDefault.
0740  */
0741 #define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION            1 << 3
0742 /**
0743  * the schema has "list" in the set of finalDefault.
0744  */
0745 #define XML_SCHEMAS_FINAL_DEFAULT_LIST            1 << 4
0746 /**
0747  * the schema has "union" in the set of finalDefault.
0748  */
0749 #define XML_SCHEMAS_FINAL_DEFAULT_UNION            1 << 5
0750 /**
0751  * the schema has "extension" in the set of blockDefault.
0752  */
0753 #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION            1 << 6
0754 /**
0755  * the schema has "restriction" in the set of blockDefault.
0756  */
0757 #define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION            1 << 7
0758 /**
0759  * the schema has "substitution" in the set of blockDefault.
0760  */
0761 #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION            1 << 8
0762 /**
0763  * the schema is currently including an other schema with
0764  * no target namespace.
0765  */
0766 #define XML_SCHEMAS_INCLUDING_CONVERT_NS            1 << 9
0767 /**
0768  * A Schemas definition
0769  */
0770 struct _xmlSchema {
0771     const xmlChar *name; /* schema name */
0772     const xmlChar *targetNamespace; /* the target namespace */
0773     const xmlChar *version;
0774     const xmlChar *id; /* Obsolete */
0775     xmlDoc *doc;
0776     xmlSchemaAnnot *annot;
0777     int flags;
0778 
0779     xmlHashTable *typeDecl;
0780     xmlHashTable *attrDecl;
0781     xmlHashTable *attrgrpDecl;
0782     xmlHashTable *elemDecl;
0783     xmlHashTable *notaDecl;
0784 
0785     xmlHashTable *schemasImports;
0786 
0787     void *_private;        /* unused by the library for users or bindings */
0788     xmlHashTable *groupDecl;
0789     xmlDict        *dict;
0790     void *includes;     /* the includes, this is opaque for now */
0791     int preserve;        /* whether to free the document */
0792     int counter; /* used to give anonymous components unique names */
0793     xmlHashTable *idcDef; /* All identity-constraint defs. */
0794     void *volatiles; /* Obsolete */
0795 };
0796 
0797 XMLPUBFUN void         xmlSchemaFreeType        (xmlSchemaType *type);
0798 XMLPUBFUN void         xmlSchemaFreeWildcard(xmlSchemaWildcard *wildcard);
0799 
0800 #ifdef __cplusplus
0801 }
0802 #endif
0803 
0804 #endif /* LIBXML_SCHEMAS_ENABLED */
0805 #endif /* __XML_SCHEMA_INTERNALS_H__ */