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;
123 * An attribute group definition.
125 * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
126 * must be kept similar
128 typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
129 typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
130 struct _xmlSchemaAttributeGroup {
131 xmlSchemaTypeType type; /* The kind of type */
132 struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
137 xmlSchemaAnnotPtr annot;
139 xmlSchemaAttributePtr attributes;
145 * XML_SCHEMAS_TYPE_MIXED:
147 * the element content type is mixed
149 #define XML_SCHEMAS_TYPE_MIXED 1 << 0
154 * Schemas type definition.
156 struct _xmlSchemaType {
157 xmlSchemaTypeType type; /* The kind of type */
158 struct _xmlSchemaType *next;/* the next type if in a sequence ... */
163 xmlSchemaAnnotPtr annot;
164 xmlSchemaTypePtr subtypes;
165 xmlSchemaAttributePtr attributes;
171 xmlSchemaContentType contentType;
174 xmlSchemaTypePtr baseType;
175 xmlSchemaFacetPtr facets;
180 * An element definition.
182 * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
183 * structures must be kept similar
186 * XML_SCHEMAS_ELEM_NILLABLE:
188 * the element is nillable
190 #define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
192 * XML_SCHEMAS_ELEM_GLOBAL:
194 * the element is global
196 #define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
198 * XML_SCHEMAS_ELEM_DEFAULT:
200 * the element has a default value
202 #define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
204 * XML_SCHEMAS_ELEM_FIXED:
206 * the element has a fixed value
208 #define XML_SCHEMAS_ELEM_FIXED 1 << 3
210 * XML_SCHEMAS_ELEM_ABSTRACT:
212 * the element is abstract
214 #define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
216 * XML_SCHEMAS_ELEM_TOPLEVEL:
218 * the element is top level
220 #define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
222 * XML_SCHEMAS_ELEM_REF:
224 * the element is a reference to a type
226 #define XML_SCHEMAS_ELEM_REF 1 << 6
228 typedef struct _xmlSchemaElement xmlSchemaElement;
229 typedef xmlSchemaElement *xmlSchemaElementPtr;
230 struct _xmlSchemaElement {
231 xmlSchemaTypeType type; /* The kind of type */
232 struct _xmlSchemaType *next;/* the next type if in a sequence ... */
237 xmlSchemaAnnotPtr annot;
238 xmlSchemaTypePtr subtypes;
239 xmlSchemaAttributePtr attributes;
245 xmlChar *targetNamespace;
247 xmlChar *namedTypeNs;
249 xmlChar *substGroupNs;
252 struct _xmlSchemaElement *refDecl;
253 xmlRegexpPtr contModel;
254 xmlSchemaContentType contentType;
258 * XML_SCHEMAS_FACET_UNKNOWN:
260 * unknown facet handling
262 #define XML_SCHEMAS_FACET_UNKNOWN 0
264 * XML_SCHEMAS_FACET_PRESERVE:
266 * preserve the type of the facet
268 #define XML_SCHEMAS_FACET_PRESERVE 1
270 * XML_SCHEMAS_FACET_REPLACE:
272 * replace the type of the facet
274 #define XML_SCHEMAS_FACET_REPLACE 2
276 * XML_SCHEMAS_FACET_COLLAPSE:
278 * collapse the types of the facet
280 #define XML_SCHEMAS_FACET_COLLAPSE 3
283 * A facet definition.
285 struct _xmlSchemaFacet {
286 xmlSchemaTypeType type; /* The kind of type */
287 struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
290 xmlSchemaAnnotPtr annot;
299 * A notation definition.
301 typedef struct _xmlSchemaNotation xmlSchemaNotation;
302 typedef xmlSchemaNotation *xmlSchemaNotationPtr;
303 struct _xmlSchemaNotation {
304 xmlSchemaTypeType type; /* The kind of type */
306 xmlSchemaAnnotPtr annot;
311 * XML_SCHEMAS_QUALIF_ELEM:
313 * the shemas requires qualified elements
315 #define XML_SCHEMAS_QUALIF_ELEM 1 << 0
317 * XML_SCHEMAS_QUALIF_ATTR:
319 * the shemas requires qualified attributes
321 #define XML_SCHEMAS_QUALIF_ATTR 1 << 1
325 * A Schemas definition
328 xmlChar *name; /* schema name */
329 xmlChar *targetNamespace; /* the target namespace */
333 xmlSchemaAnnotPtr annot;
336 xmlHashTablePtr typeDecl;
337 xmlHashTablePtr attrDecl;
338 xmlHashTablePtr attrgrpDecl;
339 xmlHashTablePtr elemDecl;
340 xmlHashTablePtr notaDecl;
342 xmlHashTablePtr schemasImports;
344 void *_private; /* unused by the library for users or bindings */
345 xmlHashTablePtr groupDecl;
348 void xmlSchemaFreeType (xmlSchemaTypePtr type);
354 #endif /* LIBXML_SCHEMAS_ENABLED */
355 #endif /* __XML_SCHEMA_INTERNALS_H__ */