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.
6 * Copy: See Copyright for the status of this software.
8 * Author: Daniel Veillard
12 #ifndef __XML_SCHEMA_H__
13 #define __XML_SCHEMA_H__
15 #include <libxml/xmlversion.h>
17 #ifdef LIBXML_SCHEMAS_ENABLED
19 #include <libxml/tree.h>
26 * This error codes are obsolete; not used any more.
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,
55 } xmlSchemaValidError;
58 * ATTENTION: Change xmlSchemaSetValidOptions's check
59 * for invalid values, if adding to the validation
63 * xmlSchemaValidOption:
65 * This is the set of XML Schema validation options.
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.
72 } xmlSchemaValidOption;
75 XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,
76 * assemble schemata using
77 * xsi:schemaLocation and
78 * xsi:noNamespaceSchemaLocation
82 * The schemas related types are kept internal
84 typedef struct _xmlSchema xmlSchema;
85 typedef xmlSchema *xmlSchemaPtr;
88 * xmlSchemaValidityErrorFunc:
89 * @ctx: the validation context
91 * @...: extra arguments
93 * Signature of an error callback from an XSD validation
95 typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
98 * xmlSchemaValidityWarningFunc:
99 * @ctx: the validation context
101 * @...: extra arguments
103 * Signature of a warning callback from an XSD validation
105 typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
108 * A schemas validation context
110 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
111 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
113 typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
114 typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
117 * Interfaces for parsing.
119 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
120 xmlSchemaNewParserCtxt (const char *URL);
121 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
122 xmlSchemaNewMemParserCtxt (const char *buffer,
124 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
125 xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
126 XMLPUBFUN void XMLCALL
127 xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
128 XMLPUBFUN void XMLCALL
129 xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
130 xmlSchemaValidityErrorFunc err,
131 xmlSchemaValidityWarningFunc warn,
133 XMLPUBFUN void XMLCALL
134 xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
135 xmlStructuredErrorFunc serror,
137 XMLPUBFUN int XMLCALL
138 xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
139 xmlSchemaValidityErrorFunc * err,
140 xmlSchemaValidityWarningFunc * warn,
142 XMLPUBFUN int XMLCALL
143 xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
145 XMLPUBFUN xmlSchemaPtr XMLCALL
146 xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
147 XMLPUBFUN void XMLCALL
148 xmlSchemaFree (xmlSchemaPtr schema);
149 #ifdef LIBXML_OUTPUT_ENABLED
150 XMLPUBFUN void XMLCALL
151 xmlSchemaDump (FILE *output,
152 xmlSchemaPtr schema);
153 #endif /* LIBXML_OUTPUT_ENABLED */
155 * Interfaces for validating
157 XMLPUBFUN void XMLCALL
158 xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
159 xmlSchemaValidityErrorFunc err,
160 xmlSchemaValidityWarningFunc warn,
162 XMLPUBFUN void XMLCALL
163 xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
164 xmlStructuredErrorFunc serror,
166 XMLPUBFUN int XMLCALL
167 xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
168 xmlSchemaValidityErrorFunc *err,
169 xmlSchemaValidityWarningFunc *warn,
171 XMLPUBFUN int XMLCALL
172 xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
174 XMLPUBFUN int XMLCALL
175 xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
177 XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
178 xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
179 XMLPUBFUN void XMLCALL
180 xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
181 XMLPUBFUN int XMLCALL
182 xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
184 XMLPUBFUN int XMLCALL
185 xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
187 XMLPUBFUN int XMLCALL
188 xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
189 xmlParserInputBufferPtr input,
191 xmlSAXHandlerPtr sax,
193 XMLPUBFUN int XMLCALL
194 xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
195 const char * filename,
198 XMLPUBFUN xmlParserCtxtPtr XMLCALL
199 xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
202 * Interface to insert Schemas SAX validation in a SAX stream
204 typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
205 typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
207 XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
208 xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
209 xmlSAXHandlerPtr *sax,
211 XMLPUBFUN int XMLCALL
212 xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
217 #endif /* LIBXML_SCHEMAS_ENABLED */
218 #endif /* __XML_SCHEMA_H__ */