xmlschemas.h revision 971771ef5a5f306ddcdd0015b2bedd320bd62c8b
14255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard/*
2be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * Summary: incomplete XML Schemas structure implementation
3be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * Description: interface to the XML Schemas handling and schema validity
4be5869729a416032a4abb5a65430d25831828f75Daniel Veillard *              checking, it is incomplete right now.
54255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard *
6be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * Copy: See Copyright for the status of this software.
74255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard *
8be5869729a416032a4abb5a65430d25831828f75Daniel Veillard * Author: Daniel Veillard
94255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard */
104255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
114255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
124255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#ifndef __XML_SCHEMA_H__
134255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#define __XML_SCHEMA_H__
144255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
154255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#include <libxml/xmlversion.h>
167ae91bcd9e94946a7be41290cb67ffc9c2cf0a9fIgor Zlatkovic
174255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#ifdef LIBXML_SCHEMAS_ENABLED
184255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
194255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#include <libxml/tree.h>
204255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
214255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#ifdef __cplusplus
224255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardextern "C" {
234255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#endif
244255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
25bea2354a33de9fe90e801234506a4e549e44e528Kasimier T. Buchcik/**
26bea2354a33de9fe90e801234506a4e549e44e528Kasimier T. Buchcik * This error codes are obsolete; not used any more.
27bea2354a33de9fe90e801234506a4e549e44e528Kasimier T. Buchcik */
284255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef enum {
294255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_OK		= 0,
304255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_NOROOT	= 1,
314255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_UNDECLAREDELEM,
324255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_NOTTOPLEVEL,
334255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_MISSING,
344255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_WRONGELEM,
354255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_NOTYPE,
364255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_NOROLLBACK,
374255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_ISABSTRACT,
384255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_NOTEMPTY,
398651f5365c182ce5c52fe1cdc2b9d72b2ecc34e2Daniel Veillard    XML_SCHEMAS_ERR_ELEMCONT,
404255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_HAVEDEFAULT,
414255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_NOTNILLABLE,
424255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_EXTRACONTENT,
434255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_INVALIDATTR,
444255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_INVALIDELEM,
45e19fc23b6427f4df516af7b3f6df7baa942e4207Daniel Veillard    XML_SCHEMAS_ERR_NOTDETERMINIST,
464255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_CONSTRUCT,
474255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_INTERNAL,
484255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_NOTSIMPLE,
494255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_ATTRUNKNOWN,
504255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_ATTRINVALID,
5191a1325beb87de8fde190157a545504632c169feDaniel Veillard    XML_SCHEMAS_ERR_VALUE,
52d3b9cd88d5d76e44ca54965d651d486485fced0dDaniel Veillard    XML_SCHEMAS_ERR_FACET,
534255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_,
544255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard    XML_SCHEMAS_ERR_XXX
554255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard} xmlSchemaValidError;
564255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
5787876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik/*
5887876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik* ATTENTION: Change xmlSchemaSetValidOptions's check
5987876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik* for invalid values, if adding to the validation
6087876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik* options below.
6187876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik*/
6287876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik/**
6387876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik * xmlSchemaValidOption:
6487876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik *
6587876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik * This is the set of XML Schema validation options.
6687876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik */
6787876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchciktypedef enum {
6887876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik    XML_SCHEMA_VAL_VC_I_CREATE			= 1<<0
6987876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	/* Default/fixed: create an attribute node
7087876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	* or an element's text node on the instance.
7187876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	*/
7287876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik} xmlSchemaValidOption;
7387876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik
7487876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik/*
7587876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik    XML_SCHEMA_VAL_XSI_ASSEMBLE			= 1<<1,
7687876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	* assemble schemata using
7787876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	* xsi:schemaLocation and
7887876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	* xsi:noNamespaceSchemaLocation
7987876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik*/
804255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
814255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard/**
824255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard * The schemas related types are kept internal
834255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard */
844255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef struct _xmlSchema xmlSchema;
854255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef xmlSchema *xmlSchemaPtr;
864255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
874255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard/**
884255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard * A schemas validation context
894255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard */
904255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
914255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
924255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
934255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
944255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
954255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
964255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
974255d504151db75c17f85192ce74f45dd2d65533Daniel Veillardtypedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
984255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
994255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard/*
1004255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard * Interfaces for parsing.
1014255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard */
102aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
103aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaNewParserCtxt	(const char *URL);
104aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
105aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaNewMemParserCtxt	(const char *buffer,
106aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic					 int size);
1079d751504d56ee9591a5094d570555367d814c614Daniel VeillardXMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
1089d751504d56ee9591a5094d570555367d814c614Daniel Veillard	    xmlSchemaNewDocParserCtxt	(xmlDocPtr doc);
109aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN void XMLCALL
110aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaFreeParserCtxt	(xmlSchemaParserCtxtPtr ctxt);
111aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN void XMLCALL
112aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt,
1134255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard					 xmlSchemaValidityErrorFunc err,
1144255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard					 xmlSchemaValidityWarningFunc warn,
1154255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard					 void *ctx);
116259f0dfa8b4f29158954959b4d0d7c03dd1eab05Daniel VeillardXMLPUBFUN int XMLCALL
117259f0dfa8b4f29158954959b4d0d7c03dd1eab05Daniel Veillard		xmlSchemaGetParserErrors	(xmlSchemaParserCtxtPtr ctxt,
118259f0dfa8b4f29158954959b4d0d7c03dd1eab05Daniel Veillard					xmlSchemaValidityErrorFunc * err,
119259f0dfa8b4f29158954959b4d0d7c03dd1eab05Daniel Veillard					xmlSchemaValidityWarningFunc * warn,
120259f0dfa8b4f29158954959b4d0d7c03dd1eab05Daniel Veillard					void **ctx);
121aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN xmlSchemaPtr XMLCALL
122aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt);
123aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN void XMLCALL
124aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaFree		(xmlSchemaPtr schema);
125a9cce9cd0d7aff3ec318b5d8d376da131b6aaad4Daniel Veillard#ifdef LIBXML_OUTPUT_ENABLED
126aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN void XMLCALL
127aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaDump		(FILE *output,
1284255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard					 xmlSchemaPtr schema);
129a9cce9cd0d7aff3ec318b5d8d376da131b6aaad4Daniel Veillard#endif /* LIBXML_OUTPUT_ENABLED */
1304255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard/*
1314255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard * Interfaces for validating
1324255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard */
133aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN void XMLCALL
134aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaSetValidErrors	(xmlSchemaValidCtxtPtr ctxt,
1354255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard					 xmlSchemaValidityErrorFunc err,
1364255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard					 xmlSchemaValidityWarningFunc warn,
1374255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard					 void *ctx);
138259f0dfa8b4f29158954959b4d0d7c03dd1eab05Daniel VeillardXMLPUBFUN int XMLCALL
13987876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	    xmlSchemaGetValidErrors	(xmlSchemaValidCtxtPtr ctxt,
14087876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik					 xmlSchemaValidityErrorFunc *err,
14187876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik					 xmlSchemaValidityWarningFunc *warn,
14287876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik					 void **ctx);
14387876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. BuchcikXMLPUBFUN int XMLCALL
14487876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	    xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt,
14587876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik					 int options);
14687876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. BuchcikXMLPUBFUN int XMLCALL
14787876407ced312c9b2c8d8b03f988a7dd484a68eKasimier T. Buchcik	    xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
148259f0dfa8b4f29158954959b4d0d7c03dd1eab05Daniel Veillard
149aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
150aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaNewValidCtxt	(xmlSchemaPtr schema);
151aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN void XMLCALL
152aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaFreeValidCtxt	(xmlSchemaValidCtxtPtr ctxt);
153aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor ZlatkovicXMLPUBFUN int XMLCALL
154aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaValidateDoc	(xmlSchemaValidCtxtPtr ctxt,
155aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic					 xmlDocPtr instance);
1565eba91f2d9b300670bdac19735c3cb07788434d6Kasimier T. BuchcikXMLPUBFUN int XMLCALL
1575eba91f2d9b300670bdac19735c3cb07788434d6Kasimier T. Buchcik            xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
1585eba91f2d9b300670bdac19735c3cb07788434d6Kasimier T. Buchcik			                 xmlNodePtr elem);
159c63fbbff72da458dd509402a56d441fb21593fe7Kasimier T. BuchcikXMLPUBFUN int XMLCALL
160aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic	    xmlSchemaValidateStream	(xmlSchemaValidCtxtPtr ctxt,
161aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic					 xmlParserInputBufferPtr input,
162aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic					 xmlCharEncoding enc,
163aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic					 xmlSAXHandlerPtr sax,
164aa3cfbd0809378d88bc907742a9ddd27cc49b335Igor Zlatkovic					 void *user_data);
165c63fbbff72da458dd509402a56d441fb21593fe7Kasimier T. BuchcikXMLPUBFUN int XMLCALL
166c63fbbff72da458dd509402a56d441fb21593fe7Kasimier T. Buchcik	    xmlSchemaValidateFile	(xmlSchemaValidCtxtPtr ctxt,
167c63fbbff72da458dd509402a56d441fb21593fe7Kasimier T. Buchcik					 const char * filename,
168c63fbbff72da458dd509402a56d441fb21593fe7Kasimier T. Buchcik					 int options);
169971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard
170971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard/*
171971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard * Interface to insert Schemas SAX velidation in a SAX stream
172971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard */
173971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillardtypedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
174971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillardtypedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
175971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard
176971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel VeillardXMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
177971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard            xmlSchemaSAXPlug		(xmlSchemaValidCtxtPtr ctxt,
178971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard					 xmlSAXHandlerPtr *sax,
179971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard					 void **user_data);
180971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel VeillardXMLPUBFUN int XMLCALL
181971771ef5a5f306ddcdd0015b2bedd320bd62c8bDaniel Veillard            xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug);
1824255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#ifdef __cplusplus
1834255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard}
1844255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#endif
1854255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard
1864255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#endif /* LIBXML_SCHEMAS_ENABLED */
1874255d504151db75c17f85192ce74f45dd2d65533Daniel Veillard#endif /* __XML_SCHEMA_H__ */
188