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 * A schemas validation context
90 typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
91 typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
93 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
94 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
96 typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
97 typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
100 * Interfaces for parsing.
102 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
103 xmlSchemaNewParserCtxt (const char *URL);
104 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
105 xmlSchemaNewMemParserCtxt (const char *buffer,
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,
116 XMLPUBFUN void XMLCALL
117 xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
118 xmlStructuredErrorFunc serror,
120 XMLPUBFUN int XMLCALL
121 xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
122 xmlSchemaValidityErrorFunc * err,
123 xmlSchemaValidityWarningFunc * warn,
125 XMLPUBFUN int XMLCALL
126 xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
128 XMLPUBFUN xmlSchemaPtr XMLCALL
129 xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
130 XMLPUBFUN void XMLCALL
131 xmlSchemaFree (xmlSchemaPtr schema);
132 #ifdef LIBXML_OUTPUT_ENABLED
133 XMLPUBFUN void XMLCALL
134 xmlSchemaDump (FILE *output,
135 xmlSchemaPtr schema);
136 #endif /* LIBXML_OUTPUT_ENABLED */
138 * Interfaces for validating
140 XMLPUBFUN void XMLCALL
141 xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
142 xmlSchemaValidityErrorFunc err,
143 xmlSchemaValidityWarningFunc warn,
145 XMLPUBFUN void XMLCALL
146 xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
147 xmlStructuredErrorFunc serror,
149 XMLPUBFUN int XMLCALL
150 xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
151 xmlSchemaValidityErrorFunc *err,
152 xmlSchemaValidityWarningFunc *warn,
154 XMLPUBFUN int XMLCALL
155 xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
157 XMLPUBFUN int XMLCALL
158 xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
160 XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
161 xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
162 XMLPUBFUN void XMLCALL
163 xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
164 XMLPUBFUN int XMLCALL
165 xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
167 XMLPUBFUN int XMLCALL
168 xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
170 XMLPUBFUN int XMLCALL
171 xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
172 xmlParserInputBufferPtr input,
174 xmlSAXHandlerPtr sax,
176 XMLPUBFUN int XMLCALL
177 xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
178 const char * filename,
182 * Interface to insert Schemas SAX velidation in a SAX stream
184 typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
185 typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
187 XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
188 xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
189 xmlSAXHandlerPtr *sax,
191 XMLPUBFUN int XMLCALL
192 xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
197 #endif /* LIBXML_SCHEMAS_ENABLED */
198 #endif /* __XML_SCHEMA_H__ */