2 * schemas.h : interface to the XML Schemas handling and schema validity
5 * See Copyright for the status of this software.
7 * Daniel.Veillard@w3.org
11 #ifndef __XML_SCHEMA_H__
12 #define __XML_SCHEMA_H__
14 #include <libxml/xmlversion.h>
16 #ifdef LIBXML_SCHEMAS_ENABLED
18 #include <libxml/tree.h>
25 XML_SCHEMAS_ERR_OK = 0,
26 XML_SCHEMAS_ERR_NOROOT = 1,
27 XML_SCHEMAS_ERR_UNDECLAREDELEM,
28 XML_SCHEMAS_ERR_NOTTOPLEVEL,
29 XML_SCHEMAS_ERR_MISSING,
30 XML_SCHEMAS_ERR_WRONGELEM,
31 XML_SCHEMAS_ERR_NOTYPE,
32 XML_SCHEMAS_ERR_NOROLLBACK,
33 XML_SCHEMAS_ERR_ISABSTRACT,
34 XML_SCHEMAS_ERR_NOTEMPTY,
35 XML_SCHEMAS_ERR_ELEMCONT,
36 XML_SCHEMAS_ERR_HAVEDEFAULT,
37 XML_SCHEMAS_ERR_NOTNILLABLE,
38 XML_SCHEMAS_ERR_EXTRACONTENT,
39 XML_SCHEMAS_ERR_INVALIDATTR,
40 XML_SCHEMAS_ERR_INVALIDELEM,
41 XML_SCHEMAS_ERR_NOTDETERMINIST,
42 XML_SCHEMAS_ERR_CONSTRUCT,
43 XML_SCHEMAS_ERR_INTERNAL,
44 XML_SCHEMAS_ERR_NOTSIMPLE,
45 XML_SCHEMAS_ERR_ATTRUNKNOWN,
46 XML_SCHEMAS_ERR_ATTRINVALID,
47 XML_SCHEMAS_ERR_VALUE,
48 XML_SCHEMAS_ERR_FACET,
51 } xmlSchemaValidError;
55 * The schemas related types are kept internal
57 typedef struct _xmlSchema xmlSchema;
58 typedef xmlSchema *xmlSchemaPtr;
61 * A schemas validation context
63 typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
64 typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
66 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
67 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
69 typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
70 typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
73 * Interfaces for parsing.
75 xmlSchemaParserCtxtPtr xmlSchemaNewParserCtxt (const char *URL);
76 xmlSchemaParserCtxtPtr xmlSchemaNewMemParserCtxt(const char *buffer,
78 void xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
79 void xmlSchemaSetParserErrors(xmlSchemaParserCtxtPtr ctxt,
80 xmlSchemaValidityErrorFunc err,
81 xmlSchemaValidityWarningFunc warn,
83 xmlSchemaPtr xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
84 void xmlSchemaFree (xmlSchemaPtr schema);
85 void xmlSchemaDump (FILE *output,
88 * Interfaces for validating
90 void xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
91 xmlSchemaValidityErrorFunc err,
92 xmlSchemaValidityWarningFunc warn,
94 xmlSchemaValidCtxtPtr xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
95 void xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
96 int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
98 int xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
99 xmlParserInputBufferPtr input,
101 xmlSAXHandlerPtr sax,
107 #endif /* LIBXML_SCHEMAS_ENABLED */
108 #endif /* __XML_SCHEMA_H__ */