Path: blob/master/venv/Lib/site-packages/lxml/includes/libxml/xmlschemas.h
811 views
/*1* Summary: incomplete XML Schemas structure implementation2* Description: interface to the XML Schemas handling and schema validity3* checking, it is incomplete right now.4*5* Copy: See Copyright for the status of this software.6*7* Author: Daniel Veillard8*/91011#ifndef __XML_SCHEMA_H__12#define __XML_SCHEMA_H__1314#include <libxml/xmlversion.h>1516#ifdef LIBXML_SCHEMAS_ENABLED1718#include <libxml/tree.h>1920#ifdef __cplusplus21extern "C" {22#endif2324/**25* This error codes are obsolete; not used any more.26*/27typedef enum {28XML_SCHEMAS_ERR_OK = 0,29XML_SCHEMAS_ERR_NOROOT = 1,30XML_SCHEMAS_ERR_UNDECLAREDELEM,31XML_SCHEMAS_ERR_NOTTOPLEVEL,32XML_SCHEMAS_ERR_MISSING,33XML_SCHEMAS_ERR_WRONGELEM,34XML_SCHEMAS_ERR_NOTYPE,35XML_SCHEMAS_ERR_NOROLLBACK,36XML_SCHEMAS_ERR_ISABSTRACT,37XML_SCHEMAS_ERR_NOTEMPTY,38XML_SCHEMAS_ERR_ELEMCONT,39XML_SCHEMAS_ERR_HAVEDEFAULT,40XML_SCHEMAS_ERR_NOTNILLABLE,41XML_SCHEMAS_ERR_EXTRACONTENT,42XML_SCHEMAS_ERR_INVALIDATTR,43XML_SCHEMAS_ERR_INVALIDELEM,44XML_SCHEMAS_ERR_NOTDETERMINIST,45XML_SCHEMAS_ERR_CONSTRUCT,46XML_SCHEMAS_ERR_INTERNAL,47XML_SCHEMAS_ERR_NOTSIMPLE,48XML_SCHEMAS_ERR_ATTRUNKNOWN,49XML_SCHEMAS_ERR_ATTRINVALID,50XML_SCHEMAS_ERR_VALUE,51XML_SCHEMAS_ERR_FACET,52XML_SCHEMAS_ERR_,53XML_SCHEMAS_ERR_XXX54} xmlSchemaValidError;5556/*57* ATTENTION: Change xmlSchemaSetValidOptions's check58* for invalid values, if adding to the validation59* options below.60*/61/**62* xmlSchemaValidOption:63*64* This is the set of XML Schema validation options.65*/66typedef enum {67XML_SCHEMA_VAL_VC_I_CREATE = 1<<068/* Default/fixed: create an attribute node69* or an element's text node on the instance.70*/71} xmlSchemaValidOption;7273/*74XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,75* assemble schemata using76* xsi:schemaLocation and77* xsi:noNamespaceSchemaLocation78*/7980/**81* The schemas related types are kept internal82*/83typedef struct _xmlSchema xmlSchema;84typedef xmlSchema *xmlSchemaPtr;8586/**87* xmlSchemaValidityErrorFunc:88* @ctx: the validation context89* @msg: the message90* @...: extra arguments91*92* Signature of an error callback from an XSD validation93*/94typedef void (XMLCDECL *xmlSchemaValidityErrorFunc)95(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);9697/**98* xmlSchemaValidityWarningFunc:99* @ctx: the validation context100* @msg: the message101* @...: extra arguments102*103* Signature of a warning callback from an XSD validation104*/105typedef void (XMLCDECL *xmlSchemaValidityWarningFunc)106(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);107108/**109* A schemas validation context110*/111typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;112typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;113114typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;115typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;116117/**118* xmlSchemaValidityLocatorFunc:119* @ctx: user provided context120* @file: returned file information121* @line: returned line information122*123* A schemas validation locator, a callback called by the validator.124* This is used when file or node informations are not available125* to find out what file and line number are affected126*127* Returns: 0 in case of success and -1 in case of error128*/129130typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx,131const char **file, unsigned long *line);132133/*134* Interfaces for parsing.135*/136XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL137xmlSchemaNewParserCtxt (const char *URL);138XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL139xmlSchemaNewMemParserCtxt (const char *buffer,140int size);141XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL142xmlSchemaNewDocParserCtxt (xmlDocPtr doc);143XMLPUBFUN void XMLCALL144xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);145XMLPUBFUN void XMLCALL146xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,147xmlSchemaValidityErrorFunc err,148xmlSchemaValidityWarningFunc warn,149void *ctx);150XMLPUBFUN void XMLCALL151xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,152xmlStructuredErrorFunc serror,153void *ctx);154XMLPUBFUN int XMLCALL155xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,156xmlSchemaValidityErrorFunc * err,157xmlSchemaValidityWarningFunc * warn,158void **ctx);159XMLPUBFUN int XMLCALL160xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);161162XMLPUBFUN xmlSchemaPtr XMLCALL163xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);164XMLPUBFUN void XMLCALL165xmlSchemaFree (xmlSchemaPtr schema);166#ifdef LIBXML_OUTPUT_ENABLED167XMLPUBFUN void XMLCALL168xmlSchemaDump (FILE *output,169xmlSchemaPtr schema);170#endif /* LIBXML_OUTPUT_ENABLED */171/*172* Interfaces for validating173*/174XMLPUBFUN void XMLCALL175xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,176xmlSchemaValidityErrorFunc err,177xmlSchemaValidityWarningFunc warn,178void *ctx);179XMLPUBFUN void XMLCALL180xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,181xmlStructuredErrorFunc serror,182void *ctx);183XMLPUBFUN int XMLCALL184xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,185xmlSchemaValidityErrorFunc *err,186xmlSchemaValidityWarningFunc *warn,187void **ctx);188XMLPUBFUN int XMLCALL189xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,190int options);191XMLPUBFUN void XMLCALL192xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt,193const char *filename);194XMLPUBFUN int XMLCALL195xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);196197XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL198xmlSchemaNewValidCtxt (xmlSchemaPtr schema);199XMLPUBFUN void XMLCALL200xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);201XMLPUBFUN int XMLCALL202xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,203xmlDocPtr instance);204XMLPUBFUN int XMLCALL205xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,206xmlNodePtr elem);207XMLPUBFUN int XMLCALL208xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,209xmlParserInputBufferPtr input,210xmlCharEncoding enc,211xmlSAXHandlerPtr sax,212void *user_data);213XMLPUBFUN int XMLCALL214xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,215const char * filename,216int options);217218XMLPUBFUN xmlParserCtxtPtr XMLCALL219xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);220221/*222* Interface to insert Schemas SAX validation in a SAX stream223*/224typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;225typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;226227XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL228xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,229xmlSAXHandlerPtr *sax,230void **user_data);231XMLPUBFUN int XMLCALL232xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);233234235XMLPUBFUN void XMLCALL236xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt,237xmlSchemaValidityLocatorFunc f,238void *ctxt);239240#ifdef __cplusplus241}242#endif243244#endif /* LIBXML_SCHEMAS_ENABLED */245#endif /* __XML_SCHEMA_H__ */246247248