1 | /* |
---|
2 | * Summary: incomplete XML Schemas structure implementation |
---|
3 | * Description: interface to the XML Schemas handling and schema validity |
---|
4 | * checking, it is incomplete right now. |
---|
5 | * |
---|
6 | * Copy: See Copyright for the status of this software. |
---|
7 | * |
---|
8 | * Author: Daniel Veillard |
---|
9 | */ |
---|
10 | |
---|
11 | |
---|
12 | #ifndef __XML_SCHEMA_H__ |
---|
13 | #define __XML_SCHEMA_H__ |
---|
14 | |
---|
15 | #include <libxml/xmlversion.h> |
---|
16 | |
---|
17 | #ifdef LIBXML_SCHEMAS_ENABLED |
---|
18 | |
---|
19 | #include <libxml/tree.h> |
---|
20 | |
---|
21 | #ifdef __cplusplus |
---|
22 | extern "C" { |
---|
23 | #endif |
---|
24 | |
---|
25 | /** |
---|
26 | * This error codes are obsolete; not used any more. |
---|
27 | */ |
---|
28 | typedef enum { |
---|
29 | XML_SCHEMAS_ERR_OK = 0, |
---|
30 | XML_SCHEMAS_ERR_NOROOT = 1, |
---|
31 | XML_SCHEMAS_ERR_UNDECLAREDELEM, |
---|
32 | XML_SCHEMAS_ERR_NOTTOPLEVEL, |
---|
33 | XML_SCHEMAS_ERR_MISSING, |
---|
34 | XML_SCHEMAS_ERR_WRONGELEM, |
---|
35 | XML_SCHEMAS_ERR_NOTYPE, |
---|
36 | XML_SCHEMAS_ERR_NOROLLBACK, |
---|
37 | XML_SCHEMAS_ERR_ISABSTRACT, |
---|
38 | XML_SCHEMAS_ERR_NOTEMPTY, |
---|
39 | XML_SCHEMAS_ERR_ELEMCONT, |
---|
40 | XML_SCHEMAS_ERR_HAVEDEFAULT, |
---|
41 | XML_SCHEMAS_ERR_NOTNILLABLE, |
---|
42 | XML_SCHEMAS_ERR_EXTRACONTENT, |
---|
43 | XML_SCHEMAS_ERR_INVALIDATTR, |
---|
44 | XML_SCHEMAS_ERR_INVALIDELEM, |
---|
45 | XML_SCHEMAS_ERR_NOTDETERMINIST, |
---|
46 | XML_SCHEMAS_ERR_CONSTRUCT, |
---|
47 | XML_SCHEMAS_ERR_INTERNAL, |
---|
48 | XML_SCHEMAS_ERR_NOTSIMPLE, |
---|
49 | XML_SCHEMAS_ERR_ATTRUNKNOWN, |
---|
50 | XML_SCHEMAS_ERR_ATTRINVALID, |
---|
51 | XML_SCHEMAS_ERR_VALUE, |
---|
52 | XML_SCHEMAS_ERR_FACET, |
---|
53 | XML_SCHEMAS_ERR_, |
---|
54 | XML_SCHEMAS_ERR_XXX |
---|
55 | } xmlSchemaValidError; |
---|
56 | |
---|
57 | /* |
---|
58 | * ATTENTION: Change xmlSchemaSetValidOptions's check |
---|
59 | * for invalid values, if adding to the validation |
---|
60 | * options below. |
---|
61 | */ |
---|
62 | /** |
---|
63 | * xmlSchemaValidOption: |
---|
64 | * |
---|
65 | * This is the set of XML Schema validation options. |
---|
66 | */ |
---|
67 | typedef enum { |
---|
68 | XML_SCHEMA_VAL_VC_I_CREATE = 1<<0 |
---|
69 | /* Default/fixed: create an attribute node |
---|
70 | * or an element's text node on the instance. |
---|
71 | */ |
---|
72 | } xmlSchemaValidOption; |
---|
73 | |
---|
74 | /* |
---|
75 | XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1, |
---|
76 | * assemble schemata using |
---|
77 | * xsi:schemaLocation and |
---|
78 | * xsi:noNamespaceSchemaLocation |
---|
79 | */ |
---|
80 | |
---|
81 | /** |
---|
82 | * The schemas related types are kept internal |
---|
83 | */ |
---|
84 | typedef struct _xmlSchema xmlSchema; |
---|
85 | typedef xmlSchema *xmlSchemaPtr; |
---|
86 | |
---|
87 | /** |
---|
88 | * A schemas validation context |
---|
89 | */ |
---|
90 | typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...); |
---|
91 | typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...); |
---|
92 | |
---|
93 | typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; |
---|
94 | typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; |
---|
95 | |
---|
96 | typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; |
---|
97 | typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; |
---|
98 | |
---|
99 | /* |
---|
100 | * Interfaces for parsing. |
---|
101 | */ |
---|
102 | XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL |
---|
103 | xmlSchemaNewParserCtxt (const char *URL); |
---|
104 | XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL |
---|
105 | xmlSchemaNewMemParserCtxt (const char *buffer, |
---|
106 | int size); |
---|
107 | XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL |
---|
108 | xmlSchemaNewDocParserCtxt (xmlDocPtr doc); |
---|
109 | XMLPUBFUN void XMLCALL |
---|
110 | xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); |
---|
111 | XMLPUBFUN void XMLCALL |
---|
112 | xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, |
---|
113 | xmlSchemaValidityErrorFunc err, |
---|
114 | xmlSchemaValidityWarningFunc warn, |
---|
115 | void *ctx); |
---|
116 | XMLPUBFUN int XMLCALL |
---|
117 | xmlSchemaGetParserErrors (xmlSchemaParserCtxtPtr ctxt, |
---|
118 | xmlSchemaValidityErrorFunc * err, |
---|
119 | xmlSchemaValidityWarningFunc * warn, |
---|
120 | void **ctx); |
---|
121 | XMLPUBFUN xmlSchemaPtr XMLCALL |
---|
122 | xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); |
---|
123 | XMLPUBFUN void XMLCALL |
---|
124 | xmlSchemaFree (xmlSchemaPtr schema); |
---|
125 | #ifdef LIBXML_OUTPUT_ENABLED |
---|
126 | XMLPUBFUN void XMLCALL |
---|
127 | xmlSchemaDump (FILE *output, |
---|
128 | xmlSchemaPtr schema); |
---|
129 | #endif /* LIBXML_OUTPUT_ENABLED */ |
---|
130 | /* |
---|
131 | * Interfaces for validating |
---|
132 | */ |
---|
133 | XMLPUBFUN void XMLCALL |
---|
134 | xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, |
---|
135 | xmlSchemaValidityErrorFunc err, |
---|
136 | xmlSchemaValidityWarningFunc warn, |
---|
137 | void *ctx); |
---|
138 | XMLPUBFUN int XMLCALL |
---|
139 | xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, |
---|
140 | xmlSchemaValidityErrorFunc *err, |
---|
141 | xmlSchemaValidityWarningFunc *warn, |
---|
142 | void **ctx); |
---|
143 | XMLPUBFUN int XMLCALL |
---|
144 | xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, |
---|
145 | int options); |
---|
146 | XMLPUBFUN int XMLCALL |
---|
147 | xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); |
---|
148 | |
---|
149 | XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL |
---|
150 | xmlSchemaNewValidCtxt (xmlSchemaPtr schema); |
---|
151 | XMLPUBFUN void XMLCALL |
---|
152 | xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); |
---|
153 | XMLPUBFUN int XMLCALL |
---|
154 | xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, |
---|
155 | xmlDocPtr instance); |
---|
156 | XMLPUBFUN int XMLCALL |
---|
157 | xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, |
---|
158 | xmlNodePtr elem); |
---|
159 | XMLPUBFUN int XMLCALL |
---|
160 | xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, |
---|
161 | xmlParserInputBufferPtr input, |
---|
162 | xmlCharEncoding enc, |
---|
163 | xmlSAXHandlerPtr sax, |
---|
164 | void *user_data); |
---|
165 | #ifdef __cplusplus |
---|
166 | } |
---|
167 | #endif |
---|
168 | |
---|
169 | #endif /* LIBXML_SCHEMAS_ENABLED */ |
---|
170 | #endif /* __XML_SCHEMA_H__ */ |
---|