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