2002-04-16 15:50:10 +00:00
/*
2003-11-18 20:56:51 +00:00
* Summary : incomplete XML Schemas structure implementation
* Description : interface to the XML Schemas handling and schema validity
* checking , it is incomplete right now .
2002-04-16 15:50:10 +00:00
*
2003-11-18 20:56:51 +00:00
* Copy : See Copyright for the status of this software .
2002-04-16 15:50:10 +00:00
*
2003-11-18 20:56:51 +00:00
* Author : Daniel Veillard
2002-04-16 15:50:10 +00:00
*/
# ifndef __XML_SCHEMA_H__
# define __XML_SCHEMA_H__
# include <libxml/xmlversion.h>
2002-11-08 17:18:52 +00:00
2002-04-16 15:50:10 +00:00
# ifdef LIBXML_SCHEMAS_ENABLED
# include <libxml/tree.h>
# ifdef __cplusplus
extern " C " {
# endif
2004-08-25 20:35:45 +00:00
/**
* This error codes are obsolete ; not used any more .
*/
2002-04-16 15:50:10 +00:00
typedef enum {
XML_SCHEMAS_ERR_OK = 0 ,
XML_SCHEMAS_ERR_NOROOT = 1 ,
XML_SCHEMAS_ERR_UNDECLAREDELEM ,
XML_SCHEMAS_ERR_NOTTOPLEVEL ,
XML_SCHEMAS_ERR_MISSING ,
XML_SCHEMAS_ERR_WRONGELEM ,
XML_SCHEMAS_ERR_NOTYPE ,
XML_SCHEMAS_ERR_NOROLLBACK ,
XML_SCHEMAS_ERR_ISABSTRACT ,
XML_SCHEMAS_ERR_NOTEMPTY ,
2002-04-17 09:06:27 +00:00
XML_SCHEMAS_ERR_ELEMCONT ,
2002-04-16 15:50:10 +00:00
XML_SCHEMAS_ERR_HAVEDEFAULT ,
XML_SCHEMAS_ERR_NOTNILLABLE ,
XML_SCHEMAS_ERR_EXTRACONTENT ,
XML_SCHEMAS_ERR_INVALIDATTR ,
XML_SCHEMAS_ERR_INVALIDELEM ,
2002-04-22 16:01:24 +00:00
XML_SCHEMAS_ERR_NOTDETERMINIST ,
2002-04-16 15:50:10 +00:00
XML_SCHEMAS_ERR_CONSTRUCT ,
XML_SCHEMAS_ERR_INTERNAL ,
XML_SCHEMAS_ERR_NOTSIMPLE ,
XML_SCHEMAS_ERR_ATTRUNKNOWN ,
XML_SCHEMAS_ERR_ATTRINVALID ,
2003-03-27 23:44:43 +00:00
XML_SCHEMAS_ERR_VALUE ,
2003-04-09 11:24:17 +00:00
XML_SCHEMAS_ERR_FACET ,
2002-04-16 15:50:10 +00:00
XML_SCHEMAS_ERR_ ,
XML_SCHEMAS_ERR_XXX
} xmlSchemaValidError ;
2004-09-29 13:29:03 +00:00
/*
* ATTENTION : Change xmlSchemaSetValidOptions ' s check
2008-04-11 12:58:43 +00:00
* for invalid values , if adding to the validation
2004-09-29 13:29:03 +00:00
* options below .
*/
/**
* xmlSchemaValidOption :
*
* This is the set of XML Schema validation options .
*/
typedef enum {
XML_SCHEMA_VAL_VC_I_CREATE = 1 < < 0
/* Default/fixed: create an attribute node
* or an element ' s text node on the instance .
*/
} xmlSchemaValidOption ;
/*
XML_SCHEMA_VAL_XSI_ASSEMBLE = 1 < < 1 ,
* assemble schemata using
* xsi : schemaLocation and
* xsi : noNamespaceSchemaLocation
*/
2002-04-16 15:50:10 +00:00
/**
* The schemas related types are kept internal
*/
typedef struct _xmlSchema xmlSchema ;
typedef xmlSchema * xmlSchemaPtr ;
/**
2008-04-11 12:58:43 +00:00
* xmlSchemaValidityErrorFunc :
* @ ctx : the validation context
* @ msg : the message
* @ . . . : extra arguments
*
* Signature of an error callback from an XSD validation
2002-04-16 15:50:10 +00:00
*/
2005-07-21 13:24:09 +00:00
typedef void ( XMLCDECL * xmlSchemaValidityErrorFunc ) ( void * ctx , const char * msg , . . . ) ;
2008-04-11 12:58:43 +00:00
/**
* xmlSchemaValidityWarningFunc :
* @ ctx : the validation context
* @ msg : the message
* @ . . . : extra arguments
*
* Signature of a warning callback from an XSD validation
*/
2005-07-21 13:24:09 +00:00
typedef void ( XMLCDECL * xmlSchemaValidityWarningFunc ) ( void * ctx , const char * msg , . . . ) ;
2002-04-16 15:50:10 +00:00
2008-04-11 12:58:43 +00:00
/**
* A schemas validation context
*/
2002-04-16 15:50:10 +00:00
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt ;
typedef xmlSchemaParserCtxt * xmlSchemaParserCtxtPtr ;
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt ;
typedef xmlSchemaValidCtxt * xmlSchemaValidCtxtPtr ;
/*
* Interfaces for parsing .
*/
2008-04-11 12:58:43 +00:00
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaNewParserCtxt ( const char * URL ) ;
2008-04-11 12:58:43 +00:00
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaNewMemParserCtxt ( const char * buffer ,
int size ) ;
2003-10-29 13:21:47 +00:00
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewDocParserCtxt ( xmlDocPtr doc ) ;
2008-04-11 12:58:43 +00:00
XMLPUBFUN void XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaFreeParserCtxt ( xmlSchemaParserCtxtPtr ctxt ) ;
2008-04-11 12:58:43 +00:00
XMLPUBFUN void XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaSetParserErrors ( xmlSchemaParserCtxtPtr ctxt ,
2002-04-16 15:50:10 +00:00
xmlSchemaValidityErrorFunc err ,
xmlSchemaValidityWarningFunc warn ,
void * ctx ) ;
2005-11-18 17:18:27 +00:00
XMLPUBFUN void XMLCALL
xmlSchemaSetParserStructuredErrors ( xmlSchemaParserCtxtPtr ctxt ,
xmlStructuredErrorFunc serror ,
void * ctx ) ;
2004-08-18 09:13:18 +00:00
XMLPUBFUN int XMLCALL
2005-07-10 19:03:16 +00:00
xmlSchemaGetParserErrors ( xmlSchemaParserCtxtPtr ctxt ,
2004-08-18 09:13:18 +00:00
xmlSchemaValidityErrorFunc * err ,
xmlSchemaValidityWarningFunc * warn ,
void * * ctx ) ;
2005-07-10 19:03:16 +00:00
XMLPUBFUN int XMLCALL
xmlSchemaIsValid ( xmlSchemaValidCtxtPtr ctxt ) ;
2008-04-11 12:58:43 +00:00
XMLPUBFUN xmlSchemaPtr XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaParse ( xmlSchemaParserCtxtPtr ctxt ) ;
2008-04-11 12:58:43 +00:00
XMLPUBFUN void XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaFree ( xmlSchemaPtr schema ) ;
2003-09-29 13:20:24 +00:00
# ifdef LIBXML_OUTPUT_ENABLED
2008-04-11 12:58:43 +00:00
XMLPUBFUN void XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaDump ( FILE * output ,
2002-04-16 15:50:10 +00:00
xmlSchemaPtr schema ) ;
2003-09-29 13:20:24 +00:00
# endif /* LIBXML_OUTPUT_ENABLED */
2002-04-16 15:50:10 +00:00
/*
* Interfaces for validating
*/
2008-04-11 12:58:43 +00:00
XMLPUBFUN void XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaSetValidErrors ( xmlSchemaValidCtxtPtr ctxt ,
2002-04-16 15:50:10 +00:00
xmlSchemaValidityErrorFunc err ,
xmlSchemaValidityWarningFunc warn ,
void * ctx ) ;
2005-07-13 23:07:49 +00:00
XMLPUBFUN void XMLCALL
xmlSchemaSetValidStructuredErrors ( xmlSchemaValidCtxtPtr ctxt ,
2005-11-18 17:18:27 +00:00
xmlStructuredErrorFunc serror ,
void * ctx ) ;
2004-08-18 09:13:18 +00:00
XMLPUBFUN int XMLCALL
2004-09-29 13:29:03 +00:00
xmlSchemaGetValidErrors ( xmlSchemaValidCtxtPtr ctxt ,
xmlSchemaValidityErrorFunc * err ,
xmlSchemaValidityWarningFunc * warn ,
void * * ctx ) ;
XMLPUBFUN int XMLCALL
xmlSchemaSetValidOptions ( xmlSchemaValidCtxtPtr ctxt ,
int options ) ;
XMLPUBFUN int XMLCALL
xmlSchemaValidCtxtGetOptions ( xmlSchemaValidCtxtPtr ctxt ) ;
2004-08-18 09:13:18 +00:00
2008-04-11 12:58:43 +00:00
XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaNewValidCtxt ( xmlSchemaPtr schema ) ;
2008-04-11 12:58:43 +00:00
XMLPUBFUN void XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaFreeValidCtxt ( xmlSchemaValidCtxtPtr ctxt ) ;
2008-04-11 12:58:43 +00:00
XMLPUBFUN int XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaValidateDoc ( xmlSchemaValidCtxtPtr ctxt ,
xmlDocPtr instance ) ;
2004-09-08 09:17:27 +00:00
XMLPUBFUN int XMLCALL
xmlSchemaValidateOneElement ( xmlSchemaValidCtxtPtr ctxt ,
xmlNodePtr elem ) ;
2005-06-15 12:54:05 +00:00
XMLPUBFUN int XMLCALL
2003-08-27 08:59:58 +00:00
xmlSchemaValidateStream ( xmlSchemaValidCtxtPtr ctxt ,
xmlParserInputBufferPtr input ,
xmlCharEncoding enc ,
xmlSAXHandlerPtr sax ,
void * user_data ) ;
2005-06-15 12:54:05 +00:00
XMLPUBFUN int XMLCALL
xmlSchemaValidateFile ( xmlSchemaValidCtxtPtr ctxt ,
const char * filename ,
int options ) ;
2005-07-09 17:32:57 +00:00
2008-04-11 12:58:43 +00:00
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlSchemaValidCtxtGetParserCtxt ( xmlSchemaValidCtxtPtr ctxt ) ;
2005-07-09 17:32:57 +00:00
/*
2008-04-11 12:58:43 +00:00
* Interface to insert Schemas SAX validation in a SAX stream
2005-07-09 17:32:57 +00:00
*/
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct ;
typedef xmlSchemaSAXPlugStruct * xmlSchemaSAXPlugPtr ;
XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
xmlSchemaSAXPlug ( xmlSchemaValidCtxtPtr ctxt ,
xmlSAXHandlerPtr * sax ,
void * * user_data ) ;
XMLPUBFUN int XMLCALL
xmlSchemaSAXUnplug ( xmlSchemaSAXPlugPtr plug ) ;
2002-04-16 15:50:10 +00:00
# ifdef __cplusplus
}
# endif
# endif /* LIBXML_SCHEMAS_ENABLED */
# endif /* __XML_SCHEMA_H__ */