2 * schemasInternals.h : internal interfaces for the XML Schemas handling
3 * and schema validity checking
5 * See Copyright for the status of this software.
7 * Daniel.Veillard@w3.org
11 #ifndef __XML_SCHEMA_INTERNALS_H__
12 #define __XML_SCHEMA_INTERNALS_H__
14 #include <libxml/xmlversion.h>
16 #ifdef LIBXML_SCHEMAS_ENABLED
18 #include <libxml/xmlregexp.h>
19 #include <libxml/hash.h>
27 * XML Schemas defines multiple type of types.
30 XML_SCHEMA_TYPE_BASIC = 1,
32 XML_SCHEMA_TYPE_FACET,
33 XML_SCHEMA_TYPE_SIMPLE,
34 XML_SCHEMA_TYPE_COMPLEX,
35 XML_SCHEMA_TYPE_SEQUENCE,
36 XML_SCHEMA_TYPE_CHOICE,
38 XML_SCHEMA_TYPE_SIMPLE_CONTENT,
39 XML_SCHEMA_TYPE_COMPLEX_CONTENT,
41 XML_SCHEMA_TYPE_RESTRICTION,
42 XML_SCHEMA_TYPE_EXTENSION,
43 XML_SCHEMA_TYPE_ELEMENT,
44 XML_SCHEMA_TYPE_ATTRIBUTE,
45 XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
46 XML_SCHEMA_TYPE_GROUP,
47 XML_SCHEMA_TYPE_NOTATION,
49 XML_SCHEMA_TYPE_UNION,
50 XML_SCHEMA_FACET_MININCLUSIVE = 1000,
51 XML_SCHEMA_FACET_MINEXCLUSIVE,
52 XML_SCHEMA_FACET_MAXINCLUSIVE,
53 XML_SCHEMA_FACET_MAXEXCLUSIVE,
54 XML_SCHEMA_FACET_TOTALDIGITS,
55 XML_SCHEMA_FACET_FRACTIONDIGITS,
56 XML_SCHEMA_FACET_PATTERN,
57 XML_SCHEMA_FACET_ENUMERATION,
58 XML_SCHEMA_FACET_WHITESPACE,
59 XML_SCHEMA_FACET_LENGTH,
60 XML_SCHEMA_FACET_MAXLENGTH,
61 XML_SCHEMA_FACET_MINLENGTH
65 XML_SCHEMA_CONTENT_UNKNOWN = 0,
66 XML_SCHEMA_CONTENT_EMPTY = 1,
67 XML_SCHEMA_CONTENT_ELEMENTS,
68 XML_SCHEMA_CONTENT_MIXED,
69 XML_SCHEMA_CONTENT_SIMPLE,
70 XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS,
71 XML_SCHEMA_CONTENT_BASIC,
72 XML_SCHEMA_CONTENT_ANY
73 } xmlSchemaContentType;
75 typedef struct _xmlSchemaVal xmlSchemaVal;
76 typedef xmlSchemaVal *xmlSchemaValPtr;
78 typedef struct _xmlSchemaType xmlSchemaType;
79 typedef xmlSchemaType *xmlSchemaTypePtr;
81 typedef struct _xmlSchemaFacet xmlSchemaFacet;
82 typedef xmlSchemaFacet *xmlSchemaFacetPtr;
87 typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
88 typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
89 struct _xmlSchemaAnnot {
90 struct _xmlSchemaAnnot *next;
91 xmlNodePtr content; /* the annotation */
95 * An attribute definition.
98 #define XML_SCHEMAS_ANYATTR_SKIP 1
99 #define XML_SCHEMAS_ANYATTR_LAX 2
100 #define XML_SCHEMAS_ANYATTR_STRICT 3
102 typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
103 typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
104 struct _xmlSchemaAttribute {
105 xmlSchemaTypeType type; /* The kind of type */
106 struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
113 xmlSchemaAnnotPtr annot;
115 xmlSchemaTypePtr base;
118 xmlSchemaTypePtr subtypes;
122 * An attribute group definition.
124 * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
125 * must be kept similar
127 typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
128 typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
129 struct _xmlSchemaAttributeGroup {
130 xmlSchemaTypeType type; /* The kind of type */
131 struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
136 xmlSchemaAnnotPtr annot;
138 xmlSchemaAttributePtr attributes;
143 * XML_SCHEMAS_TYPE_MIXED:
145 * the element content type is mixed
147 #define XML_SCHEMAS_TYPE_MIXED 1 << 0
152 * Schemas type definition.
154 struct _xmlSchemaType {
155 xmlSchemaTypeType type; /* The kind of type */
156 struct _xmlSchemaType *next;/* the next type if in a sequence ... */
161 xmlSchemaAnnotPtr annot;
162 xmlSchemaTypePtr subtypes;
163 xmlSchemaAttributePtr attributes;
169 xmlSchemaContentType contentType;
172 xmlSchemaTypePtr baseType;
173 xmlSchemaFacetPtr facets;
178 * An element definition.
180 * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
181 * structures must be kept similar
184 * XML_SCHEMAS_ELEM_NILLABLE:
186 * the element is nillable
188 #define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
190 * XML_SCHEMAS_ELEM_GLOBAL:
192 * the element is global
194 #define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
196 * XML_SCHEMAS_ELEM_DEFAULT:
198 * the element has a default value
200 #define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
202 * XML_SCHEMAS_ELEM_FIXED:
204 * the element has a fixed value
206 #define XML_SCHEMAS_ELEM_FIXED 1 << 3
208 * XML_SCHEMAS_ELEM_ABSTRACT:
210 * the element is abstract
212 #define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
214 * XML_SCHEMAS_ELEM_TOPLEVEL:
216 * the element is top level
218 #define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
220 * XML_SCHEMAS_ELEM_REF:
222 * the element is a reference to a type
224 #define XML_SCHEMAS_ELEM_REF 1 << 6
226 typedef struct _xmlSchemaElement xmlSchemaElement;
227 typedef xmlSchemaElement *xmlSchemaElementPtr;
228 struct _xmlSchemaElement {
229 xmlSchemaTypeType type; /* The kind of type */
230 struct _xmlSchemaType *next;/* the next type if in a sequence ... */
235 xmlSchemaAnnotPtr annot;
236 xmlSchemaTypePtr subtypes;
237 xmlSchemaAttributePtr attributes;
243 xmlChar *targetNamespace;
245 xmlChar *namedTypeNs;
247 xmlChar *substGroupNs;
250 struct _xmlSchemaElement *refDecl;
251 xmlRegexpPtr contModel;
252 xmlSchemaContentType contentType;
256 * XML_SCHEMAS_FACET_UNKNOWN:
258 * unknown facet handling
260 #define XML_SCHEMAS_FACET_UNKNOWN 0
262 * XML_SCHEMAS_FACET_PRESERVE:
264 * preserve the type of the facet
266 #define XML_SCHEMAS_FACET_PRESERVE 1
268 * XML_SCHEMAS_FACET_REPLACE:
270 * replace the type of the facet
272 #define XML_SCHEMAS_FACET_REPLACE 2
274 * XML_SCHEMAS_FACET_COLLAPSE:
276 * collapse the types of the facet
278 #define XML_SCHEMAS_FACET_COLLAPSE 3
281 * A facet definition.
283 struct _xmlSchemaFacet {
284 xmlSchemaTypeType type; /* The kind of type */
285 struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
288 xmlSchemaAnnotPtr annot;
297 * A notation definition.
299 typedef struct _xmlSchemaNotation xmlSchemaNotation;
300 typedef xmlSchemaNotation *xmlSchemaNotationPtr;
301 struct _xmlSchemaNotation {
302 xmlSchemaTypeType type; /* The kind of type */
304 xmlSchemaAnnotPtr annot;
309 * XML_SCHEMAS_QUALIF_ELEM:
311 * the shemas requires qualified elements
313 #define XML_SCHEMAS_QUALIF_ELEM 1 << 0
315 * XML_SCHEMAS_QUALIF_ATTR:
317 * the shemas requires qualified attributes
319 #define XML_SCHEMAS_QUALIF_ATTR 1 << 1
323 * A Schemas definition
326 xmlChar *name; /* schema name */
327 xmlChar *targetNamespace; /* the target namespace */
331 xmlSchemaAnnotPtr annot;
334 xmlHashTablePtr typeDecl;
335 xmlHashTablePtr attrDecl;
336 xmlHashTablePtr attrgrpDecl;
337 xmlHashTablePtr elemDecl;
338 xmlHashTablePtr notaDecl;
340 xmlHashTablePtr schemasImports;
342 void *_private; /* unused by the library for users or bindings */
345 void xmlSchemaFreeType (xmlSchemaTypePtr type);
351 #endif /* LIBXML_SCHEMAS_ENABLED */
352 #endif /* __XML_SCHEMA_INTERNALS_H__ */