2003-01-23 18:29:16 +00:00
/*
2003-11-18 20:56:51 +00:00
* Summary : implementation of the Relax - NG validation
* Description : implementation of the Relax - NG validation
2003-01-23 18:29:16 +00:00
*
2003-11-18 20:56:51 +00:00
* Copy : See Copyright for the status of this software .
2003-01-23 18:29:16 +00:00
*
2003-11-18 20:56:51 +00:00
* Author : Daniel Veillard
2003-01-23 18:29:16 +00:00
*/
# ifndef __XML_RELAX_NG__
# define __XML_RELAX_NG__
2003-08-25 09:05:12 +00:00
# include <libxml/xmlversion.h>
2003-01-23 18:29:16 +00:00
# include <libxml/hash.h>
moved string and UTF8 routines out of parser.c and encoding.c into a new
* encoding.c, parser.c, xmlstring.c, Makefile.am,
include/libxml/Makefile.am, include/libxml/catalog.c,
include/libxml/chvalid.h, include/libxml/encoding.h,
include/libxml/parser.h, include/libxml/relaxng.h,
include/libxml/tree.h, include/libxml/xmlwriter.h,
include/libxml/xmlstring.h:
moved string and UTF8 routines out of parser.c and encoding.c
into a new module xmlstring.c with include file
include/libxml/xmlstring.h mostly using patches from Reid
Spencer. Since xmlChar now defined in xmlstring.h, several
include files needed to have a #include added for safety.
* doc/apibuild.py: added some additional sorting for various
references displayed in the APIxxx.html files. Rebuilt the
docs, and also added new file for xmlstring module.
* configure.in: small addition to help my testing; no effect on
normal usage.
* doc/search.php: added $_GET[query] so that persistent globals
can be disabled (for recent versions of PHP)
2004-01-06 11:52:13 +00:00
# include <libxml/xmlstring.h>
2003-01-23 18:29:16 +00:00
2004-06-27 12:08:10 +00:00
# ifdef LIBXML_SCHEMAS_ENABLED
2003-10-29 17:07:51 +00:00
# ifdef __cplusplus
extern " C " {
# endif
2003-01-23 18:29:16 +00:00
typedef struct _xmlRelaxNG xmlRelaxNG ;
typedef xmlRelaxNG * xmlRelaxNGPtr ;
/**
2008-04-11 12:58:43 +00:00
* xmlRelaxNGValidityErrorFunc :
* @ ctx : the validation context
* @ msg : the message
* @ . . . : extra arguments
*
* Signature of an error callback from a Relax - NG validation
2003-01-23 18:29:16 +00:00
*/
2005-07-21 13:24:09 +00:00
typedef void ( XMLCDECL * xmlRelaxNGValidityErrorFunc ) ( void * ctx , const char * msg , . . . ) ;
2008-04-11 12:58:43 +00:00
/**
* xmlRelaxNGValidityWarningFunc :
* @ ctx : the validation context
* @ msg : the message
* @ . . . : extra arguments
*
* Signature of a warning callback from a Relax - NG validation
*/
2005-07-21 13:24:09 +00:00
typedef void ( XMLCDECL * xmlRelaxNGValidityWarningFunc ) ( void * ctx , const char * msg , . . . ) ;
2003-01-23 18:29:16 +00:00
2008-04-11 12:58:43 +00:00
/**
* A schemas validation context
*/
2003-01-23 18:29:16 +00:00
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt ;
typedef xmlRelaxNGParserCtxt * xmlRelaxNGParserCtxtPtr ;
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt ;
typedef xmlRelaxNGValidCtxt * xmlRelaxNGValidCtxtPtr ;
2003-03-07 18:32:59 +00:00
/*
* xmlRelaxNGValidErr :
*
* List of possible Relax NG validation errors
*/
typedef enum {
XML_RELAXNG_OK = 0 ,
XML_RELAXNG_ERR_MEMORY ,
XML_RELAXNG_ERR_TYPE ,
XML_RELAXNG_ERR_TYPEVAL ,
2003-03-18 00:31:04 +00:00
XML_RELAXNG_ERR_DUPID ,
2003-03-07 18:32:59 +00:00
XML_RELAXNG_ERR_TYPECMP ,
XML_RELAXNG_ERR_NOSTATE ,
XML_RELAXNG_ERR_NODEFINE ,
XML_RELAXNG_ERR_LISTEXTRA ,
2003-03-15 21:30:25 +00:00
XML_RELAXNG_ERR_LISTEMPTY ,
2003-03-07 18:32:59 +00:00
XML_RELAXNG_ERR_INTERNODATA ,
XML_RELAXNG_ERR_INTERSEQ ,
XML_RELAXNG_ERR_INTEREXTRA ,
XML_RELAXNG_ERR_ELEMNAME ,
2003-03-15 21:30:25 +00:00
XML_RELAXNG_ERR_ATTRNAME ,
2003-03-07 18:32:59 +00:00
XML_RELAXNG_ERR_ELEMNONS ,
2003-03-15 21:30:25 +00:00
XML_RELAXNG_ERR_ATTRNONS ,
2003-03-07 18:32:59 +00:00
XML_RELAXNG_ERR_ELEMWRONGNS ,
2003-03-15 21:30:25 +00:00
XML_RELAXNG_ERR_ATTRWRONGNS ,
2003-03-07 18:32:59 +00:00
XML_RELAXNG_ERR_ELEMEXTRANS ,
2003-03-15 21:30:25 +00:00
XML_RELAXNG_ERR_ATTREXTRANS ,
2003-03-07 18:32:59 +00:00
XML_RELAXNG_ERR_ELEMNOTEMPTY ,
XML_RELAXNG_ERR_NOELEM ,
XML_RELAXNG_ERR_NOTELEM ,
XML_RELAXNG_ERR_ATTRVALID ,
XML_RELAXNG_ERR_CONTENTVALID ,
XML_RELAXNG_ERR_EXTRACONTENT ,
XML_RELAXNG_ERR_INVALIDATTR ,
XML_RELAXNG_ERR_DATAELEM ,
XML_RELAXNG_ERR_VALELEM ,
XML_RELAXNG_ERR_LISTELEM ,
XML_RELAXNG_ERR_DATATYPE ,
XML_RELAXNG_ERR_VALUE ,
XML_RELAXNG_ERR_LIST ,
XML_RELAXNG_ERR_NOGRAMMAR ,
2003-03-16 17:52:32 +00:00
XML_RELAXNG_ERR_EXTRADATA ,
2003-03-17 15:37:12 +00:00
XML_RELAXNG_ERR_LACKDATA ,
2003-04-14 16:11:26 +00:00
XML_RELAXNG_ERR_INTERNAL ,
XML_RELAXNG_ERR_ELEMWRONG ,
XML_RELAXNG_ERR_TEXTWRONG
2003-03-07 18:32:59 +00:00
} xmlRelaxNGValidErr ;
2004-01-25 19:54:59 +00:00
/*
* xmlRelaxNGParserFlags :
*
* List of possible Relax NG Parser flags
*/
typedef enum {
XML_RELAXNGP_NONE = 0 ,
XML_RELAXNGP_FREE_DOC = 1 ,
XML_RELAXNGP_CRNG = 2
} xmlRelaxNGParserFlag ;
2004-11-03 14:20:29 +00:00
XMLPUBFUN int XMLCALL
xmlRelaxNGInitTypes ( void ) ;
XMLPUBFUN void XMLCALL
xmlRelaxNGCleanupTypes ( void ) ;
2003-01-23 18:29:16 +00:00
/*
* Interfaces for parsing .
*/
2003-08-25 09:05:12 +00:00
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewParserCtxt ( const char * URL ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewMemParserCtxt ( const char * buffer ,
2003-01-23 18:29:16 +00:00
int size ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewDocParserCtxt ( xmlDocPtr doc ) ;
2003-04-17 09:09:19 +00:00
2004-01-25 19:54:59 +00:00
XMLPUBFUN int XMLCALL
xmlRelaxParserSetFlag ( xmlRelaxNGParserCtxtPtr ctxt ,
int flag ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN void XMLCALL
xmlRelaxNGFreeParserCtxt ( xmlRelaxNGParserCtxtPtr ctxt ) ;
XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserErrors ( xmlRelaxNGParserCtxtPtr ctxt ,
2003-01-23 18:29:16 +00:00
xmlRelaxNGValidityErrorFunc err ,
xmlRelaxNGValidityWarningFunc warn ,
void * ctx ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN int XMLCALL
xmlRelaxNGGetParserErrors ( xmlRelaxNGParserCtxtPtr ctxt ,
2003-07-18 15:16:57 +00:00
xmlRelaxNGValidityErrorFunc * err ,
xmlRelaxNGValidityWarningFunc * warn ,
void * * ctx ) ;
2006-01-09 16:28:20 +00:00
XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserStructuredErrors (
xmlRelaxNGParserCtxtPtr ctxt ,
xmlStructuredErrorFunc serror ,
void * ctx ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN xmlRelaxNGPtr XMLCALL
xmlRelaxNGParse ( xmlRelaxNGParserCtxtPtr ctxt ) ;
XMLPUBFUN void XMLCALL
xmlRelaxNGFree ( xmlRelaxNGPtr schema ) ;
2003-09-29 13:20:24 +00:00
# ifdef LIBXML_OUTPUT_ENABLED
2003-08-25 10:34:41 +00:00
XMLPUBFUN void XMLCALL
xmlRelaxNGDump ( FILE * output ,
2003-01-23 18:29:16 +00:00
xmlRelaxNGPtr schema ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN void XMLCALL
xmlRelaxNGDumpTree ( FILE * output ,
2003-02-16 15:44:18 +00:00
xmlRelaxNGPtr schema ) ;
2003-09-29 13:20:24 +00:00
# endif /* LIBXML_OUTPUT_ENABLED */
2003-01-23 18:29:16 +00:00
/*
* Interfaces for validating
*/
2003-08-25 10:34:41 +00:00
XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidErrors ( xmlRelaxNGValidCtxtPtr ctxt ,
2003-01-23 18:29:16 +00:00
xmlRelaxNGValidityErrorFunc err ,
xmlRelaxNGValidityWarningFunc warn ,
void * ctx ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN int XMLCALL
xmlRelaxNGGetValidErrors ( xmlRelaxNGValidCtxtPtr ctxt ,
2003-07-18 15:16:57 +00:00
xmlRelaxNGValidityErrorFunc * err ,
xmlRelaxNGValidityWarningFunc * warn ,
void * * ctx ) ;
2005-07-13 23:07:49 +00:00
XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidStructuredErrors ( xmlRelaxNGValidCtxtPtr ctxt ,
xmlStructuredErrorFunc serror , void * ctx ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
xmlRelaxNGNewValidCtxt ( xmlRelaxNGPtr schema ) ;
XMLPUBFUN void XMLCALL
xmlRelaxNGFreeValidCtxt ( xmlRelaxNGValidCtxtPtr ctxt ) ;
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateDoc ( xmlRelaxNGValidCtxtPtr ctxt ,
2003-03-24 13:57:34 +00:00
xmlDocPtr doc ) ;
2003-04-15 23:32:22 +00:00
/*
* Interfaces for progressive validation when possible
*/
2003-08-25 10:34:41 +00:00
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushElement ( xmlRelaxNGValidCtxtPtr ctxt ,
2003-04-15 23:32:22 +00:00
xmlDocPtr doc ,
xmlNodePtr elem ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushCData ( xmlRelaxNGValidCtxtPtr ctxt ,
2003-04-15 23:32:22 +00:00
const xmlChar * data ,
int len ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePopElement ( xmlRelaxNGValidCtxtPtr ctxt ,
2003-04-15 23:32:22 +00:00
xmlDocPtr doc ,
xmlNodePtr elem ) ;
2003-08-25 10:34:41 +00:00
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateFullElement ( xmlRelaxNGValidCtxtPtr ctxt ,
2003-04-15 23:32:22 +00:00
xmlDocPtr doc ,
xmlNodePtr elem ) ;
2003-10-29 17:07:51 +00:00
# ifdef __cplusplus
}
# endif
2004-06-27 12:08:10 +00:00
# endif /* LIBXML_SCHEMAS_ENABLED */
2003-01-23 18:29:16 +00:00
# endif /* __XML_RELAX_NG__ */