schemasInternals.h 25 KB

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