added Info.plist
[TestXSLT.git] / libxml2 / include / libxml / schemasInternals.h
1 /*
2  * schemasInternals.h : internal interfaces for the XML Schemas handling
3  *                      and schema validity checking
4  *
5  * See Copyright for the status of this software.
6  *
7  * Daniel.Veillard@w3.org
8  */
9
10
11 #ifndef __XML_SCHEMA_INTERNALS_H__
12 #define __XML_SCHEMA_INTERNALS_H__
13
14 #include <libxml/xmlversion.h>
15
16 #ifdef LIBXML_SCHEMAS_ENABLED
17
18 #include <libxml/xmlregexp.h>
19 #include <libxml/hash.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25
26 /*
27  * XML Schemas defines multiple type of types.
28  */
29 typedef enum {
30     XML_SCHEMA_TYPE_BASIC = 1,
31     XML_SCHEMA_TYPE_ANY,
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,
37     XML_SCHEMA_TYPE_ALL,
38     XML_SCHEMA_TYPE_SIMPLE_CONTENT,
39     XML_SCHEMA_TYPE_COMPLEX_CONTENT,
40     XML_SCHEMA_TYPE_UR,
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,
48     XML_SCHEMA_TYPE_LIST,
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
62 } xmlSchemaTypeType;
63
64 typedef enum {
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;
74
75 typedef struct _xmlSchemaVal xmlSchemaVal;
76 typedef xmlSchemaVal *xmlSchemaValPtr;
77
78 typedef struct _xmlSchemaType xmlSchemaType;
79 typedef xmlSchemaType *xmlSchemaTypePtr;
80
81 typedef struct _xmlSchemaFacet xmlSchemaFacet;
82 typedef xmlSchemaFacet *xmlSchemaFacetPtr;
83
84 /**
85  * Annotation
86  */
87 typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
88 typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
89 struct _xmlSchemaAnnot {
90     struct _xmlSchemaAnnot *next;
91     xmlNodePtr content;         /* the annotation */
92 };
93
94 /**
95  * An attribute definition.
96  */
97
98 #define XML_SCHEMAS_ANYATTR_SKIP        1
99 #define XML_SCHEMAS_ANYATTR_LAX         2
100 #define XML_SCHEMAS_ANYATTR_STRICT      3
101
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 ... */
107     xmlChar *name;
108     xmlChar *id;
109     xmlChar *ref;
110     xmlChar *refNs;
111     xmlChar *typeName;
112     xmlChar *typeNs;
113     xmlSchemaAnnotPtr annot;
114
115     xmlSchemaTypePtr base;
116     int occurs;
117     xmlChar *defValue;
118     xmlSchemaTypePtr subtypes;
119     xmlNodePtr node;
120 };
121
122 /**
123  * An attribute group definition.
124  *
125  * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
126  * must be kept similar
127  */
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 ... */
133     xmlChar *name;
134     xmlChar *id;
135     xmlChar *ref;
136     xmlChar *refNs;
137     xmlSchemaAnnotPtr annot;
138
139     xmlSchemaAttributePtr attributes;
140     xmlNodePtr node;
141 };
142
143
144 /**
145  * XML_SCHEMAS_TYPE_MIXED:
146  *
147  * the element content type is mixed
148  */
149 #define XML_SCHEMAS_TYPE_MIXED          1 << 0
150
151 /**
152  * _xmlSchemaType:
153  *
154  * Schemas type definition.
155  */
156 struct _xmlSchemaType {
157     xmlSchemaTypeType type;     /* The kind of type */
158     struct _xmlSchemaType *next;/* the next type if in a sequence ... */
159     xmlChar *name;
160     xmlChar *id;
161     xmlChar *ref;
162     xmlChar *refNs;
163     xmlSchemaAnnotPtr annot;
164     xmlSchemaTypePtr subtypes;
165     xmlSchemaAttributePtr attributes;
166     xmlNodePtr node;
167     int minOccurs;
168     int maxOccurs;
169
170     int flags;
171     xmlSchemaContentType contentType;
172     xmlChar *base;
173     xmlChar *baseNs;
174     xmlSchemaTypePtr baseType;
175     xmlSchemaFacetPtr facets;
176 };
177
178 /**
179  * xmlSchemaElement:
180  * An element definition.
181  *
182  * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
183  * structures must be kept similar
184  */
185 /**
186  * XML_SCHEMAS_ELEM_NILLABLE:
187  *
188  * the element is nillable
189  */
190 #define XML_SCHEMAS_ELEM_NILLABLE       1 << 0
191 /**
192  * XML_SCHEMAS_ELEM_GLOBAL:
193  *
194  * the element is global
195  */
196 #define XML_SCHEMAS_ELEM_GLOBAL         1 << 1
197 /**
198  * XML_SCHEMAS_ELEM_DEFAULT:
199  *
200  * the element has a default value
201  */
202 #define XML_SCHEMAS_ELEM_DEFAULT        1 << 2
203 /**
204  * XML_SCHEMAS_ELEM_FIXED:
205  *
206  * the element has a fixed value
207  */
208 #define XML_SCHEMAS_ELEM_FIXED          1 << 3
209 /**
210  * XML_SCHEMAS_ELEM_ABSTRACT:
211  *
212  * the element is abstract
213  */
214 #define XML_SCHEMAS_ELEM_ABSTRACT       1 << 4
215 /**
216  * XML_SCHEMAS_ELEM_TOPLEVEL:
217  *
218  * the element is top level
219  */
220 #define XML_SCHEMAS_ELEM_TOPLEVEL       1 << 5
221 /**
222  * XML_SCHEMAS_ELEM_REF:
223  *
224  * the element is a reference to a type
225  */
226 #define XML_SCHEMAS_ELEM_REF            1 << 6
227
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 ... */
233     xmlChar *name;
234     xmlChar *id;
235     xmlChar *ref;
236     xmlChar *refNs;
237     xmlSchemaAnnotPtr annot;
238     xmlSchemaTypePtr subtypes;
239     xmlSchemaAttributePtr attributes;
240     xmlNodePtr node;
241     int minOccurs;
242     int maxOccurs;
243
244     int flags;
245     xmlChar *targetNamespace;
246     xmlChar *namedType;
247     xmlChar *namedTypeNs;
248     xmlChar *substGroup;
249     xmlChar *substGroupNs;
250     xmlChar *scope;
251     xmlChar *value;
252     struct _xmlSchemaElement *refDecl;
253     xmlRegexpPtr contModel;
254     xmlSchemaContentType contentType;
255 };
256
257 /*
258  * XML_SCHEMAS_FACET_UNKNOWN:
259  *
260  * unknown facet handling
261  */
262 #define XML_SCHEMAS_FACET_UNKNOWN       0
263 /*
264  * XML_SCHEMAS_FACET_PRESERVE:
265  *
266  * preserve the type of the facet
267  */
268 #define XML_SCHEMAS_FACET_PRESERVE      1
269 /*
270  * XML_SCHEMAS_FACET_REPLACE:
271  *
272  * replace the type of the facet
273  */
274 #define XML_SCHEMAS_FACET_REPLACE       2
275 /*
276  * XML_SCHEMAS_FACET_COLLAPSE:
277  *
278  * collapse the types of the facet
279  */
280 #define XML_SCHEMAS_FACET_COLLAPSE      3
281
282 /**
283  * A facet definition.
284  */
285 struct _xmlSchemaFacet {
286     xmlSchemaTypeType type;     /* The kind of type */
287     struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
288     xmlChar *value;
289     xmlChar *id;
290     xmlSchemaAnnotPtr annot;
291     xmlNodePtr node;
292     int fixed;
293     int whitespace;
294     xmlSchemaValPtr val;
295     xmlRegexpPtr    regexp;
296 };
297
298 /**
299  * A notation definition.
300  */
301 typedef struct _xmlSchemaNotation xmlSchemaNotation;
302 typedef xmlSchemaNotation *xmlSchemaNotationPtr;
303 struct _xmlSchemaNotation {
304     xmlSchemaTypeType type;     /* The kind of type */
305     xmlChar *name;
306     xmlSchemaAnnotPtr annot;
307     xmlChar *identifier;
308 };
309
310 /**
311  * XML_SCHEMAS_QUALIF_ELEM:
312  *
313  * the shemas requires qualified elements
314  */
315 #define XML_SCHEMAS_QUALIF_ELEM         1 << 0
316 /**
317  * XML_SCHEMAS_QUALIF_ATTR:
318  *
319  * the shemas requires qualified attributes
320  */
321 #define XML_SCHEMAS_QUALIF_ATTR         1 << 1
322 /**
323  * _xmlSchema:
324  *
325  * A Schemas definition
326  */
327 struct _xmlSchema {
328     xmlChar *name;        /* schema name */
329     xmlChar *targetNamespace;     /* the target namespace */
330     xmlChar *version;
331     xmlChar *id;
332     xmlDocPtr doc;
333     xmlSchemaAnnotPtr annot;
334     int flags;
335
336     xmlHashTablePtr typeDecl;
337     xmlHashTablePtr attrDecl;
338     xmlHashTablePtr attrgrpDecl;
339     xmlHashTablePtr elemDecl;
340     xmlHashTablePtr notaDecl;
341
342     xmlHashTablePtr schemasImports;
343
344     void *_private;     /* unused by the library for users or bindings */
345     xmlHashTablePtr groupDecl;
346 };
347
348 void    xmlSchemaFreeType       (xmlSchemaTypePtr type);
349
350 #ifdef __cplusplus
351 }
352 #endif
353
354 #endif /* LIBXML_SCHEMAS_ENABLED */
355 #endif /* __XML_SCHEMA_INTERNALS_H__ */
356
357