00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __XML_SCHEMA_INTERNALS_H__
00024
00025 #define __XML_SCHEMA_INTERNALS_H__
00026
00027
00028
00029 #include <libxml/xmlversion.h>
00030
00031
00032
00033 #ifdef LIBXML_SCHEMAS_ENABLED
00034
00035
00036
00037 #include <libxml/xmlregexp.h>
00038
00039 #include <libxml/hash.h>
00040
00041 #include <libxml/dict.h>
00042
00043
00044
00045 #ifdef __cplusplus
00046
00047 extern "C" {
00048
00049 #endif
00050
00051
00052
00053 typedef enum {
00054
00055 XML_SCHEMAS_UNKNOWN = 0,
00056
00057 XML_SCHEMAS_STRING,
00058
00059 XML_SCHEMAS_NORMSTRING,
00060
00061 XML_SCHEMAS_DECIMAL,
00062
00063 XML_SCHEMAS_TIME,
00064
00065 XML_SCHEMAS_GDAY,
00066
00067 XML_SCHEMAS_GMONTH,
00068
00069 XML_SCHEMAS_GMONTHDAY,
00070
00071 XML_SCHEMAS_GYEAR,
00072
00073 XML_SCHEMAS_GYEARMONTH,
00074
00075 XML_SCHEMAS_DATE,
00076
00077 XML_SCHEMAS_DATETIME,
00078
00079 XML_SCHEMAS_DURATION,
00080
00081 XML_SCHEMAS_FLOAT,
00082
00083 XML_SCHEMAS_DOUBLE,
00084
00085 XML_SCHEMAS_BOOLEAN,
00086
00087 XML_SCHEMAS_TOKEN,
00088
00089 XML_SCHEMAS_LANGUAGE,
00090
00091 XML_SCHEMAS_NMTOKEN,
00092
00093 XML_SCHEMAS_NMTOKENS,
00094
00095 XML_SCHEMAS_NAME,
00096
00097 XML_SCHEMAS_QNAME,
00098
00099 XML_SCHEMAS_NCNAME,
00100
00101 XML_SCHEMAS_ID,
00102
00103 XML_SCHEMAS_IDREF,
00104
00105 XML_SCHEMAS_IDREFS,
00106
00107 XML_SCHEMAS_ENTITY,
00108
00109 XML_SCHEMAS_ENTITIES,
00110
00111 XML_SCHEMAS_NOTATION,
00112
00113 XML_SCHEMAS_ANYURI,
00114
00115 XML_SCHEMAS_INTEGER,
00116
00117 XML_SCHEMAS_NPINTEGER,
00118
00119 XML_SCHEMAS_NINTEGER,
00120
00121 XML_SCHEMAS_NNINTEGER,
00122
00123 XML_SCHEMAS_PINTEGER,
00124
00125 XML_SCHEMAS_INT,
00126
00127 XML_SCHEMAS_UINT,
00128
00129 XML_SCHEMAS_LONG,
00130
00131 XML_SCHEMAS_ULONG,
00132
00133 XML_SCHEMAS_SHORT,
00134
00135 XML_SCHEMAS_USHORT,
00136
00137 XML_SCHEMAS_BYTE,
00138
00139 XML_SCHEMAS_UBYTE,
00140
00141 XML_SCHEMAS_HEXBINARY,
00142
00143 XML_SCHEMAS_BASE64BINARY,
00144
00145 XML_SCHEMAS_ANYTYPE,
00146
00147 XML_SCHEMAS_ANYSIMPLETYPE
00148
00149 } xmlSchemaValType;
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159 typedef enum {
00160
00161 XML_SCHEMA_TYPE_BASIC = 1,
00162
00163 XML_SCHEMA_TYPE_ANY,
00164
00165 XML_SCHEMA_TYPE_FACET,
00166
00167 XML_SCHEMA_TYPE_SIMPLE,
00168
00169 XML_SCHEMA_TYPE_COMPLEX,
00170
00171 XML_SCHEMA_TYPE_SEQUENCE,
00172
00173 XML_SCHEMA_TYPE_CHOICE,
00174
00175 XML_SCHEMA_TYPE_ALL,
00176
00177 XML_SCHEMA_TYPE_SIMPLE_CONTENT,
00178
00179 XML_SCHEMA_TYPE_COMPLEX_CONTENT,
00180
00181 XML_SCHEMA_TYPE_UR,
00182
00183 XML_SCHEMA_TYPE_RESTRICTION,
00184
00185 XML_SCHEMA_TYPE_EXTENSION,
00186
00187 XML_SCHEMA_TYPE_ELEMENT,
00188
00189 XML_SCHEMA_TYPE_ATTRIBUTE,
00190
00191 XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
00192
00193 XML_SCHEMA_TYPE_GROUP,
00194
00195 XML_SCHEMA_TYPE_NOTATION,
00196
00197 XML_SCHEMA_TYPE_LIST,
00198
00199 XML_SCHEMA_TYPE_UNION,
00200
00201 XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
00202
00203 XML_SCHEMA_FACET_MININCLUSIVE = 1000,
00204
00205 XML_SCHEMA_FACET_MINEXCLUSIVE,
00206
00207 XML_SCHEMA_FACET_MAXINCLUSIVE,
00208
00209 XML_SCHEMA_FACET_MAXEXCLUSIVE,
00210
00211 XML_SCHEMA_FACET_TOTALDIGITS,
00212
00213 XML_SCHEMA_FACET_FRACTIONDIGITS,
00214
00215 XML_SCHEMA_FACET_PATTERN,
00216
00217 XML_SCHEMA_FACET_ENUMERATION,
00218
00219 XML_SCHEMA_FACET_WHITESPACE,
00220
00221 XML_SCHEMA_FACET_LENGTH,
00222
00223 XML_SCHEMA_FACET_MAXLENGTH,
00224
00225 XML_SCHEMA_FACET_MINLENGTH
00226
00227 } xmlSchemaTypeType;
00228
00229
00230
00231 typedef enum {
00232
00233 XML_SCHEMA_CONTENT_UNKNOWN = 0,
00234
00235 XML_SCHEMA_CONTENT_EMPTY = 1,
00236
00237 XML_SCHEMA_CONTENT_ELEMENTS,
00238
00239 XML_SCHEMA_CONTENT_MIXED,
00240
00241 XML_SCHEMA_CONTENT_SIMPLE,
00242
00243 XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS,
00244
00245 XML_SCHEMA_CONTENT_BASIC,
00246
00247 XML_SCHEMA_CONTENT_ANY
00248
00249 } xmlSchemaContentType;
00250
00251
00252
00253 typedef struct _xmlSchemaVal xmlSchemaVal;
00254
00255 typedef xmlSchemaVal *xmlSchemaValPtr;
00256
00257
00258
00259 typedef struct _xmlSchemaType xmlSchemaType;
00260
00261 typedef xmlSchemaType *xmlSchemaTypePtr;
00262
00263
00264
00265 typedef struct _xmlSchemaFacet xmlSchemaFacet;
00266
00267 typedef xmlSchemaFacet *xmlSchemaFacetPtr;
00268
00269
00270
00277 typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
00278
00279 typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
00280
00281 struct _xmlSchemaAnnot {
00282
00283 struct _xmlSchemaAnnot *next;
00284
00285 xmlNodePtr content;
00286
00287 };
00288
00289
00290
00303 #define XML_SCHEMAS_ANYATTR_SKIP 1
00304
00317 #define XML_SCHEMAS_ANYATTR_LAX 2
00318
00331 #define XML_SCHEMAS_ANYATTR_STRICT 3
00332
00343 #define XML_SCHEMAS_ANY_SKIP 1
00344
00357 #define XML_SCHEMAS_ANY_LAX 2
00358
00371 #define XML_SCHEMAS_ANY_STRICT 3
00372
00385 #define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
00386
00397 #define XML_SCHEMAS_ATTR_USE_REQUIRED 1
00398
00409 #define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
00410
00421 #define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
00422
00433 #define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
00434
00447 #define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8
00448
00459 #define XML_SCHEMAS_ATTR_FIXED 1 << 9
00460
00461
00462
00473 typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
00474
00475 typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
00476
00477 struct _xmlSchemaAttribute {
00478
00479 xmlSchemaTypeType type;
00480
00481 struct _xmlSchemaAttribute *next;
00482
00483 const xmlChar *name;
00484
00485 const xmlChar *id;
00486
00487 const xmlChar *ref;
00488
00489 const xmlChar *refNs;
00490
00491 const xmlChar *typeName;
00492
00493 const xmlChar *typeNs;
00494
00495 xmlSchemaAnnotPtr annot;
00496
00497
00498
00499 xmlSchemaTypePtr base;
00500
00501 int occurs;
00502
00503 const xmlChar *defValue;
00504
00505 xmlSchemaTypePtr subtypes;
00506
00507 xmlNodePtr node;
00508
00509 const xmlChar *targetNamespace;
00510
00511 int flags;
00512
00513 const xmlChar *refPrefix;
00514
00515 xmlSchemaValPtr defVal;
00516
00517 xmlSchemaAttributePtr refDecl;
00518
00519 };
00520
00521
00522
00531 typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
00532
00533 typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
00534
00535 struct _xmlSchemaAttributeLink {
00536
00537 struct _xmlSchemaAttributeLink *next;
00538
00539 struct _xmlSchemaAttribute *attr;
00540
00541 };
00542
00543
00544
00555 #define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
00556
00557
00558
00567 typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
00568
00569 typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
00570
00571 struct _xmlSchemaWildcardNs {
00572
00573 struct _xmlSchemaWildcardNs *next;
00574
00575 const xmlChar *value;
00576
00577 };
00578
00579
00580
00589 typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
00590
00591 typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
00592
00593 struct _xmlSchemaWildcard {
00594
00595 xmlSchemaTypeType type;
00596
00597 const xmlChar *id;
00598
00599 xmlSchemaAnnotPtr annot;
00600
00601 xmlNodePtr node;
00602
00603 int minOccurs;
00604
00605 int maxOccurs;
00606
00607 int processContents;
00608
00609 int any;
00610
00611 xmlSchemaWildcardNsPtr nsSet;
00612
00613 xmlSchemaWildcardNsPtr negNsSet;
00614
00615 int flags;
00616
00617 };
00618
00619
00620
00631 #define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
00632
00643 #define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
00644
00655 #define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
00656
00657
00658
00671 typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
00672
00673 typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
00674
00675 struct _xmlSchemaAttributeGroup {
00676
00677 xmlSchemaTypeType type;
00678
00679 struct _xmlSchemaAttribute *next;
00680
00681 const xmlChar *name;
00682
00683 const xmlChar *id;
00684
00685 const xmlChar *ref;
00686
00687 const xmlChar *refNs;
00688
00689 xmlSchemaAnnotPtr annot;
00690
00691
00692
00693 xmlSchemaAttributePtr attributes;
00694
00695 xmlNodePtr node;
00696
00697 int flags;
00698
00699 xmlSchemaWildcardPtr attributeWildcard;
00700
00701 const xmlChar *refPrefix;
00702
00703 xmlSchemaAttributeGroupPtr refItem;
00704
00705 const xmlChar *targetNamespace;
00706
00707 };
00708
00709
00710
00721 typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
00722
00723 typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
00724
00725 struct _xmlSchemaTypeLink {
00726
00727 struct _xmlSchemaTypeLink *next;
00728
00729 xmlSchemaTypePtr type;
00730
00731 };
00732
00733
00734
00743 typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
00744
00745 typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
00746
00747 struct _xmlSchemaFacetLink {
00748
00749 struct _xmlSchemaFacetLink *next;
00750
00751 xmlSchemaFacetPtr facet;
00752
00753 };
00754
00755
00756
00767 #define XML_SCHEMAS_TYPE_MIXED 1 << 0
00768
00779 #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
00780
00791 #define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
00792
00803 #define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
00804
00817 #define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4
00818
00829 #define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5
00830
00841 #define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6
00842
00853 #define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7
00854
00865 #define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8
00866
00877 #define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9
00878
00889 #define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10
00890
00901 #define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11
00902
00913 #define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12
00914
00925 #define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13
00926
00937 #define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14
00938
00949 #define XML_SCHEMAS_TYPE_MARKED 1 << 16
00950
00963 #define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17
00964
00975 #define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18
00976
00987 #define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19
00988
00999 #define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20
01000
01001
01002
01013 struct _xmlSchemaType {
01014
01015 xmlSchemaTypeType type;
01016
01017 struct _xmlSchemaType *next;
01018
01019 const xmlChar *name;
01020
01021 const xmlChar *id;
01022
01023 const xmlChar *ref;
01024
01025 const xmlChar *refNs;
01026
01027 xmlSchemaAnnotPtr annot;
01028
01029 xmlSchemaTypePtr subtypes;
01030
01031 xmlSchemaAttributePtr attributes;
01032
01033 xmlNodePtr node;
01034
01035 int minOccurs;
01036
01037 int maxOccurs;
01038
01039
01040
01041 int flags;
01042
01043 xmlSchemaContentType contentType;
01044
01045 const xmlChar *base;
01046
01047 const xmlChar *baseNs;
01048
01049 xmlSchemaTypePtr baseType;
01050
01051 xmlSchemaFacetPtr facets;
01052
01053 struct _xmlSchemaType *redef;
01054
01055 int recurse;
01056
01057 xmlSchemaAttributeLinkPtr attributeUses;
01058
01059 xmlSchemaWildcardPtr attributeWildcard;
01060
01061 int builtInType;
01062
01063 xmlSchemaTypeLinkPtr memberTypes;
01064
01065 xmlSchemaFacetLinkPtr facetSet;
01066
01067 const xmlChar *refPrefix;
01068
01069 xmlSchemaTypePtr contentTypeDef;
01070
01071 xmlRegexpPtr contModel;
01072
01073 const xmlChar *targetNamespace;
01074
01075 };
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01103 #define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
01104
01115 #define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
01116
01127 #define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
01128
01139 #define XML_SCHEMAS_ELEM_FIXED 1 << 3
01140
01151 #define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
01152
01165 #define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
01166
01177 #define XML_SCHEMAS_ELEM_REF 1 << 6
01178
01191 #define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
01192
01205 #define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
01206
01217 #define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
01218
01229 #define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
01230
01241 #define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
01242
01253 #define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
01254
01265 #define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
01266
01277 #define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
01278
01289 #define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
01290
01301 #define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
01302
01303
01304
01305
01306
01307 typedef struct _xmlSchemaElement xmlSchemaElement;
01308
01309 typedef xmlSchemaElement *xmlSchemaElementPtr;
01310
01311 struct _xmlSchemaElement {
01312
01313 xmlSchemaTypeType type;
01314
01315 struct _xmlSchemaType *next;
01316
01317 const xmlChar *name;
01318
01319 const xmlChar *id;
01320
01321 const xmlChar *ref;
01322
01323 const xmlChar *refNs;
01324
01325 xmlSchemaAnnotPtr annot;
01326
01327 xmlSchemaTypePtr subtypes;
01328
01329 xmlSchemaAttributePtr attributes;
01330
01331 xmlNodePtr node;
01332
01333 int minOccurs;
01334
01335 int maxOccurs;
01336
01337
01338
01339 int flags;
01340
01341 const xmlChar *targetNamespace;
01342
01343 const xmlChar *namedType;
01344
01345 const xmlChar *namedTypeNs;
01346
01347 const xmlChar *substGroup;
01348
01349 const xmlChar *substGroupNs;
01350
01351 const xmlChar *scope;
01352
01353 const xmlChar *value;
01354
01355 struct _xmlSchemaElement *refDecl;
01356
01357 xmlRegexpPtr contModel;
01358
01359 xmlSchemaContentType contentType;
01360
01361 const xmlChar *refPrefix;
01362
01363 xmlSchemaValPtr defVal;
01364
01365 };
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379 #define XML_SCHEMAS_FACET_UNKNOWN 0
01380
01381
01382
01383
01384
01385
01386
01387
01388
01389
01390
01391 #define XML_SCHEMAS_FACET_PRESERVE 1
01392
01393
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403 #define XML_SCHEMAS_FACET_REPLACE 2
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415 #define XML_SCHEMAS_FACET_COLLAPSE 3
01416
01423 struct _xmlSchemaFacet {
01424
01425 xmlSchemaTypeType type;
01426
01427 struct _xmlSchemaFacet *next;
01428
01429 const xmlChar *value;
01430
01431 const xmlChar *id;
01432
01433 xmlSchemaAnnotPtr annot;
01434
01435 xmlNodePtr node;
01436
01437 int fixed;
01438
01439 int whitespace;
01440
01441 xmlSchemaValPtr val;
01442
01443 xmlRegexpPtr regexp;
01444
01445 };
01446
01447
01448
01455 typedef struct _xmlSchemaNotation xmlSchemaNotation;
01456
01457 typedef xmlSchemaNotation *xmlSchemaNotationPtr;
01458
01459 struct _xmlSchemaNotation {
01460
01461 xmlSchemaTypeType type;
01462
01463 const xmlChar *name;
01464
01465 xmlSchemaAnnotPtr annot;
01466
01467 const xmlChar *identifier;
01468
01469 const xmlChar *targetNamespace;
01470
01471 };
01472
01473
01474
01485 #define XML_SCHEMAS_QUALIF_ELEM 1 << 0
01486
01497 #define XML_SCHEMAS_QUALIF_ATTR 1 << 1
01498
01509 #define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
01510
01521 #define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
01522
01533 #define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
01534
01545 #define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
01546
01557 #define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
01558
01569 #define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
01570
01581 #define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
01582
01595 #define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
01596
01607 struct _xmlSchema {
01608
01609 const xmlChar *name;
01610
01611 const xmlChar *targetNamespace;
01612
01613 const xmlChar *version;
01614
01615 const xmlChar *id;
01616
01617 xmlDocPtr doc;
01618
01619 xmlSchemaAnnotPtr annot;
01620
01621 int flags;
01622
01623
01624
01625 xmlHashTablePtr typeDecl;
01626
01627 xmlHashTablePtr attrDecl;
01628
01629 xmlHashTablePtr attrgrpDecl;
01630
01631 xmlHashTablePtr elemDecl;
01632
01633 xmlHashTablePtr notaDecl;
01634
01635
01636
01637 xmlHashTablePtr schemasImports;
01638
01639
01640
01641 void *_private;
01642
01643 xmlHashTablePtr groupDecl;
01644
01645 xmlDictPtr dict;
01646
01647 void *includes;
01648
01649 int preserve;
01650
01651 int counter;
01652
01653 };
01654
01655
01656
01657 XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
01658
01659 XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
01660
01661
01662
01663 #ifdef __cplusplus
01664
01665 }
01666
01667 #endif
01668
01669
01670
01671 #endif
01672
01673 #endif
01674