Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:44:18

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