epoc32/include/stdapis/libxml2/libxml2_schemasinternals.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2  * Summary: internal interfaces for XML Schemas
     3  * Description: internal interfaces for the XML Schemas handling
     4  *              and schema validity checking
     5  *
     6  * Copy: See Copyright for the status of this software.
     7  *
     8  * Author: Daniel Veillard
     9  * Portion Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
    10  */
    11 
    12 /** @file
    13 @publishedAll
    14 @released
    15 */
    16 
    17 
    18 #ifndef XML_SCHEMA_INTERNALS_H
    19 #define XML_SCHEMA_INTERNALS_H
    20 
    21 #include <stdapis/libxml2/libxml2_xmlversion.h>
    22 
    23 #if defined(LIBXML_SCHEMAS_ENABLED) || defined(XMLENGINE_XMLSCHEMA_DATATYPES)
    24 
    25 #ifdef LIBXML_REGEXP_ENABLED
    26 #include "libxml2_xmlregexp.h"
    27 #endif
    28 
    29 #include <stdapis/libxml2/libxml2_hash.h>
    30 #include <stdapis/libxml2/libxml2_dict.h>
    31 
    32 #ifdef __cplusplus
    33 extern "C" {
    34 #endif
    35 
    36 
    37 #define XML_SCHEMAS_NAMESPACE_NAME \
    38     (const xmlChar*) "http://www.w3.org/2001/XMLSchema"
    39 
    40 
    41 /*
    42  * XML Schemas defines multiple type of types.
    43  */
    44 typedef enum {
    45     XML_SCHEMA_TYPE_BASIC           = 1,
    46     XML_SCHEMA_TYPE_ANY,
    47     XML_SCHEMA_TYPE_FACET,
    48     XML_SCHEMA_TYPE_SIMPLE,
    49     XML_SCHEMA_TYPE_COMPLEX,
    50     XML_SCHEMA_TYPE_SEQUENCE,
    51     XML_SCHEMA_TYPE_CHOICE,
    52     XML_SCHEMA_TYPE_ALL,
    53     XML_SCHEMA_TYPE_SIMPLE_CONTENT,
    54     XML_SCHEMA_TYPE_COMPLEX_CONTENT,
    55     XML_SCHEMA_TYPE_UR,
    56     XML_SCHEMA_TYPE_RESTRICTION,
    57     XML_SCHEMA_TYPE_EXTENSION,
    58     XML_SCHEMA_TYPE_ELEMENT,
    59     XML_SCHEMA_TYPE_ATTRIBUTE,
    60     XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
    61     XML_SCHEMA_TYPE_GROUP,
    62     XML_SCHEMA_TYPE_NOTATION,
    63     XML_SCHEMA_TYPE_LIST,
    64     XML_SCHEMA_TYPE_UNION,
    65     XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
    66     XML_SCHEMA_FACET_MININCLUSIVE   = 1000,
    67     XML_SCHEMA_FACET_MINEXCLUSIVE,
    68     XML_SCHEMA_FACET_MAXINCLUSIVE,
    69     XML_SCHEMA_FACET_MAXEXCLUSIVE,
    70     XML_SCHEMA_FACET_TOTALDIGITS,
    71     XML_SCHEMA_FACET_FRACTIONDIGITS,
    72     XML_SCHEMA_FACET_PATTERN,
    73     XML_SCHEMA_FACET_ENUMERATION,
    74     XML_SCHEMA_FACET_WHITESPACE,
    75     XML_SCHEMA_FACET_LENGTH,
    76     XML_SCHEMA_FACET_MAXLENGTH,
    77     XML_SCHEMA_FACET_MINLENGTH
    78 } xmlSchemaTypeType;
    79 
    80 typedef enum {
    81     XML_SCHEMA_CONTENT_UNKNOWN  = 0,
    82     XML_SCHEMA_CONTENT_EMPTY    = 1,
    83     XML_SCHEMA_CONTENT_ELEMENTS,
    84     XML_SCHEMA_CONTENT_MIXED,
    85     XML_SCHEMA_CONTENT_SIMPLE,
    86     XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS,
    87     XML_SCHEMA_CONTENT_BASIC,
    88     XML_SCHEMA_CONTENT_ANY
    89 } xmlSchemaContentType;
    90 
    91 typedef enum {
    92     XML_SCHEMAS_UNKNOWN     = 0,
    93     XML_SCHEMAS_STRING,
    94     XML_SCHEMAS_NORMSTRING,
    95     XML_SCHEMAS_DECIMAL,
    96     XML_SCHEMAS_TIME,
    97     XML_SCHEMAS_GDAY,
    98     XML_SCHEMAS_GMONTH,
    99     XML_SCHEMAS_GMONTHDAY,
   100     XML_SCHEMAS_GYEAR,
   101     XML_SCHEMAS_GYEARMONTH,
   102     XML_SCHEMAS_DATE,
   103     XML_SCHEMAS_DATETIME,
   104     XML_SCHEMAS_DURATION,
   105     XML_SCHEMAS_FLOAT,
   106     XML_SCHEMAS_DOUBLE,
   107     XML_SCHEMAS_BOOLEAN,
   108     XML_SCHEMAS_TOKEN,
   109     XML_SCHEMAS_LANGUAGE,
   110     XML_SCHEMAS_NMTOKEN,
   111     XML_SCHEMAS_NMTOKENS,
   112     XML_SCHEMAS_NAME,
   113     XML_SCHEMAS_QNAME,
   114     XML_SCHEMAS_NCNAME,
   115     XML_SCHEMAS_ID,
   116     XML_SCHEMAS_IDREF,
   117     XML_SCHEMAS_IDREFS,
   118     XML_SCHEMAS_ENTITY,
   119     XML_SCHEMAS_ENTITIES,
   120     XML_SCHEMAS_NOTATION,
   121     XML_SCHEMAS_ANYURI,
   122     XML_SCHEMAS_INTEGER,
   123     XML_SCHEMAS_NPINTEGER,
   124     XML_SCHEMAS_NINTEGER,
   125     XML_SCHEMAS_NNINTEGER,
   126     XML_SCHEMAS_PINTEGER,
   127     XML_SCHEMAS_INT,
   128     XML_SCHEMAS_UINT,
   129     XML_SCHEMAS_LONG,
   130     XML_SCHEMAS_ULONG,
   131     XML_SCHEMAS_SHORT,
   132     XML_SCHEMAS_USHORT,
   133     XML_SCHEMAS_BYTE,
   134     XML_SCHEMAS_UBYTE,
   135     XML_SCHEMAS_HEXBINARY,
   136     XML_SCHEMAS_BASE64BINARY
   137 } xmlSchemaValType;
   138 
   139 
   140 /* Date value */
   141 struct _xmlSchemaValDate {
   142     long            year;
   143     unsigned int    mon :4; /* 1 <=  mon    <= 12   */
   144     unsigned int    day :5; /* 1 <=  day    <= 31   */
   145     unsigned int    hour:5; /* 0 <=  hour   <= 23   */
   146     unsigned int    min :6; /* 0 <=  min    <= 59   */
   147     double          sec;
   148     unsigned int    tz_flag :1; /* is tzo explicitely set? */
   149     int             tzo :11;    /* -1440 <= tzo <= 1440 */
   150 };
   151 
   152 /* Duration value */
   153 typedef struct _xmlSchemaValDuration xmlSchemaValDuration;
   154 typedef xmlSchemaValDuration *xmlSchemaValDurationPtr;
   155 struct _xmlSchemaValDuration {
   156     long       mon;        /* mon stores years also */
   157     long       day;
   158     double     sec;        /* sec stores min and hour also */
   159 };
   160 
   161 typedef struct _xmlSchemaValDecimal xmlSchemaValDecimal;
   162 typedef xmlSchemaValDecimal *xmlSchemaValDecimalPtr;
   163 struct _xmlSchemaValDecimal {
   164     /* would use long long but not portable */
   165     unsigned long lo;
   166     unsigned long mi;
   167     unsigned long hi;
   168     unsigned int  extra;
   169     unsigned int  sign:1;
   170     unsigned int  frac:7;
   171     unsigned int total:8;
   172 };
   173 
   174 typedef struct _xmlSchemaValQName xmlSchemaValQName;
   175 typedef xmlSchemaValQName *xmlSchemaValQNamePtr;
   176 struct _xmlSchemaValQName {
   177     xmlChar *name;
   178     xmlChar *uri;
   179 };
   180 
   181 typedef struct _xmlSchemaValHex xmlSchemaValHex;
   182 typedef xmlSchemaValHex *xmlSchemaValHexPtr;
   183 struct _xmlSchemaValHex {
   184     xmlChar     *str;
   185     unsigned int total;
   186 };
   187 
   188 typedef struct _xmlSchemaValBase64 xmlSchemaValBase64;
   189 typedef xmlSchemaValBase64 *xmlSchemaValBase64Ptr;
   190 struct _xmlSchemaValBase64 {
   191     xmlChar     *str;
   192     unsigned int total;
   193 };
   194 
   195 typedef struct _xmlSchemaValDate xmlSchemaValDate;
   196 typedef xmlSchemaValDate *xmlSchemaValDatePtr;
   197 
   198 struct _xmlSchemaVal {
   199     xmlSchemaValType type;
   200     union {
   201         xmlSchemaValDecimal     decimal;
   202         xmlSchemaValDate        date;
   203         xmlSchemaValDuration    dur;
   204         xmlSchemaValQName       qname;
   205         xmlSchemaValHex         hex;
   206         xmlSchemaValBase64      base64;
   207         float    f;
   208         double   d;
   209         int      b;
   210         xmlChar* str;
   211     } value;
   212 };
   213 
   214 typedef struct _xmlSchemaVal xmlSchemaVal;
   215 typedef xmlSchemaVal *xmlSchemaValPtr;
   216 
   217 typedef struct _xmlSchemaType xmlSchemaType;
   218 typedef xmlSchemaType *xmlSchemaTypePtr;
   219 
   220 typedef struct _xmlSchemaFacet xmlSchemaFacet;
   221 typedef xmlSchemaFacet *xmlSchemaFacetPtr;
   222 
   223 /**
   224  * Annotation
   225  */
   226 typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
   227 typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
   228 struct _xmlSchemaAnnot {
   229     struct _xmlSchemaAnnot *next;
   230     xmlNodePtr content;         /* the annotation */
   231 };
   232 
   233 /**
   234  * XML_SCHEMAS_ANYATTR_SKIP:
   235  *
   236  * Skip unknown attribute from validation
   237  */
   238 #define XML_SCHEMAS_ANYATTR_SKIP    1
   239 /**
   240  * XML_SCHEMAS_ANYATTR_LAX:
   241  *
   242  * Ignore validation non definition on attributes
   243  */
   244 #define XML_SCHEMAS_ANYATTR_LAX     2
   245 /**
   246  * XML_SCHEMAS_ANYATTR_STRICT:
   247  *
   248  * Apply strict validation rules on attributes
   249  */
   250 #define XML_SCHEMAS_ANYATTR_STRICT  3
   251 
   252 /**
   253  * XML_SCHEMAS_ATTR_USE_PROHIBITED:
   254  *
   255  * The attribute is prohibited.
   256  */
   257 #define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
   258 
   259 /**
   260  * XML_SCHEMAS_ATTR_USE_REQUIRED:
   261  *
   262  * The attribute is required.
   263  */
   264 #define XML_SCHEMAS_ATTR_USE_REQUIRED 1
   265 
   266 /**
   267  * XML_SCHEMAS_ATTR_USE_OPTIONAL:
   268  *
   269  * The attribute is optional.
   270  */
   271 #define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
   272 
   273 /**
   274  * XML_SCHEMAS_ATTR_NSDEFAULT:
   275  *
   276  * allow elements in no namespace
   277  */
   278 #define XML_SCHEMAS_ATTR_NSDEFAULT  1 << 7
   279 
   280 /**
   281  * xmlSchemaAttribute:
   282  * An attribute definition.
   283  */
   284 
   285 typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
   286 typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
   287 struct _xmlSchemaAttribute {
   288     xmlSchemaTypeType type; /* The kind of type */
   289     struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
   290     const xmlChar *name;
   291     const xmlChar *id;
   292     const xmlChar *ref;
   293     const xmlChar *refNs;
   294     const xmlChar *typeName;
   295     const xmlChar *typeNs;
   296     xmlSchemaAnnotPtr annot;
   297 
   298     xmlSchemaTypePtr base;
   299     int occurs;
   300     const xmlChar *defValue;
   301     xmlSchemaTypePtr subtypes;
   302     xmlNodePtr node;
   303     const xmlChar *targetNamespace;
   304     int flags;
   305 };
   306 
   307 /**
   308  * An attribute group definition.
   309  *
   310  * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
   311  * must be kept similar
   312  */
   313 typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
   314 typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
   315 struct _xmlSchemaAttributeGroup {
   316     xmlSchemaTypeType type; /* The kind of type */
   317     struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
   318     const xmlChar *name;
   319     const xmlChar *id;
   320     const xmlChar *ref;
   321     const xmlChar *refNs;
   322     xmlSchemaAnnotPtr annot;
   323 
   324     xmlSchemaAttributePtr attributes;
   325     xmlNodePtr node;
   326 };
   327 
   328 
   329 /**
   330  * XML_SCHEMAS_TYPE_MIXED:
   331  *
   332  * the element content type is mixed
   333  */
   334 #define XML_SCHEMAS_TYPE_MIXED      1 << 0
   335 
   336 /**
   337  * _xmlSchemaType:
   338  *
   339  * Schemas type definition.
   340  */
   341 struct _xmlSchemaType {
   342     xmlSchemaTypeType type; /* The kind of type */
   343     struct _xmlSchemaType *next;/* the next type if in a sequence ... */
   344     const xmlChar *name;
   345     const xmlChar *id;
   346     const xmlChar *ref;
   347     const xmlChar *refNs;
   348     xmlSchemaAnnotPtr annot;
   349     xmlSchemaTypePtr subtypes;
   350     xmlSchemaAttributePtr attributes;
   351     xmlNodePtr node;
   352     int minOccurs;
   353     int maxOccurs;
   354 
   355     int flags;
   356     xmlSchemaContentType contentType;
   357     const xmlChar *base;
   358     const xmlChar *baseNs;
   359     xmlSchemaTypePtr baseType;
   360     xmlSchemaFacetPtr facets;
   361     struct _xmlSchemaType *redef;/* possible redefinitions for the type */
   362     int recurse;
   363 };
   364 
   365 /*
   366  * xmlSchemaElement:
   367  * An element definition.
   368  *
   369  * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
   370  * structures must be kept similar
   371  */
   372 /**
   373  * XML_SCHEMAS_ELEM_NILLABLE:
   374  *
   375  * the element is nillable
   376  */
   377 #define XML_SCHEMAS_ELEM_NILLABLE   1 << 0
   378 /**
   379  * XML_SCHEMAS_ELEM_GLOBAL:
   380  *
   381  * the element is global
   382  */
   383 #define XML_SCHEMAS_ELEM_GLOBAL     1 << 1
   384 /**
   385  * XML_SCHEMAS_ELEM_DEFAULT:
   386  *
   387  * the element has a default value
   388  */
   389 #define XML_SCHEMAS_ELEM_DEFAULT    1 << 2
   390 /**
   391  * XML_SCHEMAS_ELEM_FIXED:
   392  *
   393  * the element has a fixed value
   394  */
   395 #define XML_SCHEMAS_ELEM_FIXED      1 << 3
   396 /**
   397  * XML_SCHEMAS_ELEM_ABSTRACT:
   398  *
   399  * the element is abstract
   400  */
   401 #define XML_SCHEMAS_ELEM_ABSTRACT   1 << 4
   402 /**
   403  * XML_SCHEMAS_ELEM_TOPLEVEL:
   404  *
   405  * the element is top level
   406  */
   407 #define XML_SCHEMAS_ELEM_TOPLEVEL   1 << 5
   408 /**
   409  * XML_SCHEMAS_ELEM_REF:
   410  *
   411  * the element is a reference to a type
   412  */
   413 #define XML_SCHEMAS_ELEM_REF        1 << 6
   414 /**
   415  * XML_SCHEMAS_ELEM_NSDEFAULT:
   416  *
   417  * allow elements in no namespace
   418  */
   419 #define XML_SCHEMAS_ELEM_NSDEFAULT  1 << 7
   420 
   421 typedef struct _xmlSchemaElement xmlSchemaElement;
   422 typedef xmlSchemaElement *xmlSchemaElementPtr;
   423 struct _xmlSchemaElement {
   424     xmlSchemaTypeType type; /* The kind of type */
   425     struct _xmlSchemaType *next;/* the next type if in a sequence ... */
   426     const xmlChar *name;
   427     const xmlChar *id;
   428     const xmlChar *ref;
   429     const xmlChar *refNs;
   430     xmlSchemaAnnotPtr annot;
   431     xmlSchemaTypePtr subtypes;
   432     xmlSchemaAttributePtr attributes;
   433     xmlNodePtr node;
   434     int minOccurs;
   435     int maxOccurs;
   436 
   437     int flags;
   438     const xmlChar *targetNamespace;
   439     const xmlChar *namedType;
   440     const xmlChar *namedTypeNs;
   441     const xmlChar *substGroup;
   442     const xmlChar *substGroupNs;
   443     const xmlChar *scope;
   444     const xmlChar *value;
   445     struct _xmlSchemaElement *refDecl;
   446 #ifdef LIBXML_REGEXP_ENABLED
   447     xmlRegexpPtr contModel;
   448 #endif
   449     xmlSchemaContentType contentType;
   450 };
   451 
   452 /*
   453  * XML_SCHEMAS_FACET_UNKNOWN:
   454  *
   455  * unknown facet handling
   456  */
   457 #define XML_SCHEMAS_FACET_UNKNOWN   0
   458 /*
   459  * XML_SCHEMAS_FACET_PRESERVE:
   460  *
   461  * preserve the type of the facet
   462  */
   463 #define XML_SCHEMAS_FACET_PRESERVE  1
   464 /*
   465  * XML_SCHEMAS_FACET_REPLACE:
   466  *
   467  * replace the type of the facet
   468  */
   469 #define XML_SCHEMAS_FACET_REPLACE   2
   470 /*
   471  * XML_SCHEMAS_FACET_COLLAPSE:
   472  *
   473  * collapse the types of the facet
   474  */
   475 #define XML_SCHEMAS_FACET_COLLAPSE  3
   476 
   477 /**
   478  * A facet definition.
   479  */
   480 struct _xmlSchemaFacet {
   481     xmlSchemaTypeType type; /* The kind of type */
   482     struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
   483     const xmlChar *value;
   484     const xmlChar *id;
   485     xmlSchemaAnnotPtr annot;
   486     xmlNodePtr node;
   487     int fixed;
   488     int whitespace;
   489     xmlSchemaValPtr val;
   490 #ifdef LIBXML_REGEXP_ENABLED
   491     xmlRegexpPtr    regexp;
   492 #endif
   493 };
   494 
   495 /**
   496  * A notation definition.
   497  */
   498 typedef struct _xmlSchemaNotation xmlSchemaNotation;
   499 typedef xmlSchemaNotation *xmlSchemaNotationPtr;
   500 struct _xmlSchemaNotation {
   501     xmlSchemaTypeType type; /* The kind of type */
   502     const xmlChar *name;
   503     xmlSchemaAnnotPtr annot;
   504     const xmlChar *identifier;
   505 };
   506 
   507 /**
   508  * XML_SCHEMAS_QUALIF_ELEM:
   509  *
   510  * the shemas requires qualified elements
   511  */
   512 #define XML_SCHEMAS_QUALIF_ELEM     1 << 0
   513 /**
   514  * XML_SCHEMAS_QUALIF_ATTR:
   515  *
   516  * the shemas requires qualified attributes
   517  */
   518 #define XML_SCHEMAS_QUALIF_ATTR     1 << 1
   519 /**
   520  * _xmlSchema:
   521  *
   522  * A Schemas definition
   523  */
   524 struct _xmlSchema {
   525     const xmlChar *name;        /* schema name */
   526     const xmlChar *targetNamespace;     /* the target namespace */
   527     const xmlChar *version;
   528     const xmlChar *id;
   529     xmlDocPtr doc;
   530     xmlSchemaAnnotPtr annot;
   531     int flags;
   532 
   533     xmlHashTablePtr typeDecl;
   534     xmlHashTablePtr attrDecl;
   535     xmlHashTablePtr attrgrpDecl;
   536     xmlHashTablePtr elemDecl;
   537     xmlHashTablePtr notaDecl;
   538 
   539     xmlHashTablePtr schemasImports;
   540 
   541     void *_private; /* unused by the library for users or bindings */
   542     xmlHashTablePtr groupDecl;
   543     xmlDictPtr      dict;
   544     void *includes;     /* the includes, this is opaque for now */
   545     int preserve;   /* whether to free the document */
   546 };
   547 
   548 XMLPUBFUN void XMLCALL  xmlSchemaFreeType   (xmlSchemaTypePtr type);
   549 
   550 #ifdef __cplusplus
   551 }
   552 #endif
   553 
   554 #endif /* #if defined(LIBXML_SCHEMAS_ENABLED) || defined(XMLENGINE_XMLSCHEMA_DATATYPES) */
   555 #endif /* XML_SCHEMA_INTERNALS_H */
   556 
   557 
   558