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