imgtools/imgcheck/libxml/xmlschemas.h
changeset 2 39c28ec933dd
equal deleted inserted replaced
1:820b22e13ff1 2:39c28ec933dd
       
     1 /*
       
     2  * Summary: XML Schemas structure implementation
       
     3  * Description: interface to the XML Schemas handling and schema validity
       
     4  *              checking, 
       
     5  *
       
     6  * Copy: See Copyright for the status of this software.
       
     7  *
       
     8  * Author: Daniel Veillard
       
     9  */
       
    10 
       
    11 
       
    12 #ifndef __XML_SCHEMA_H__
       
    13 #define __XML_SCHEMA_H__
       
    14 
       
    15 #include <libxml/xmlversion.h>
       
    16 
       
    17 #ifdef LIBXML_SCHEMAS_ENABLED
       
    18 
       
    19 #include <libxml/tree.h>
       
    20 
       
    21 #ifdef __cplusplus
       
    22 extern "C" {
       
    23 #endif
       
    24 
       
    25 /**
       
    26  * This error codes are obsolete; not used any more.
       
    27  */
       
    28 typedef enum {
       
    29     XML_SCHEMAS_ERR_OK		= 0,
       
    30     XML_SCHEMAS_ERR_NOROOT	= 1,
       
    31     XML_SCHEMAS_ERR_UNDECLAREDELEM,
       
    32     XML_SCHEMAS_ERR_NOTTOPLEVEL,
       
    33     XML_SCHEMAS_ERR_MISSING,
       
    34     XML_SCHEMAS_ERR_WRONGELEM,
       
    35     XML_SCHEMAS_ERR_NOTYPE,
       
    36     XML_SCHEMAS_ERR_NOROLLBACK,
       
    37     XML_SCHEMAS_ERR_ISABSTRACT,
       
    38     XML_SCHEMAS_ERR_NOTEMPTY,
       
    39     XML_SCHEMAS_ERR_ELEMCONT,
       
    40     XML_SCHEMAS_ERR_HAVEDEFAULT,
       
    41     XML_SCHEMAS_ERR_NOTNILLABLE,
       
    42     XML_SCHEMAS_ERR_EXTRACONTENT,
       
    43     XML_SCHEMAS_ERR_INVALIDATTR,
       
    44     XML_SCHEMAS_ERR_INVALIDELEM,
       
    45     XML_SCHEMAS_ERR_NOTDETERMINIST,
       
    46     XML_SCHEMAS_ERR_CONSTRUCT,
       
    47     XML_SCHEMAS_ERR_INTERNAL,
       
    48     XML_SCHEMAS_ERR_NOTSIMPLE,
       
    49     XML_SCHEMAS_ERR_ATTRUNKNOWN,
       
    50     XML_SCHEMAS_ERR_ATTRINVALID,
       
    51     XML_SCHEMAS_ERR_VALUE,
       
    52     XML_SCHEMAS_ERR_FACET,
       
    53     XML_SCHEMAS_ERR_,
       
    54     XML_SCHEMAS_ERR_XXX
       
    55 } xmlSchemaValidError;
       
    56 
       
    57 /*
       
    58 * ATTENTION: Change xmlSchemaSetValidOptions's check
       
    59 * for invalid values, if adding to the validation 
       
    60 * options below.
       
    61 */
       
    62 /**
       
    63  * xmlSchemaValidOption:
       
    64  *
       
    65  * This is the set of XML Schema validation options.
       
    66  */
       
    67 typedef enum {
       
    68     XML_SCHEMA_VAL_VC_I_CREATE			= 1<<0
       
    69 	/* Default/fixed: create an attribute node
       
    70 	* or an element's text node on the instance.
       
    71 	*/
       
    72 } xmlSchemaValidOption;
       
    73 
       
    74 /*
       
    75     XML_SCHEMA_VAL_XSI_ASSEMBLE			= 1<<1,
       
    76 	* assemble schemata using
       
    77 	* xsi:schemaLocation and
       
    78 	* xsi:noNamespaceSchemaLocation
       
    79 */
       
    80 
       
    81 /**
       
    82  * The schemas related types are kept internal
       
    83  */
       
    84 typedef struct _xmlSchema xmlSchema;
       
    85 typedef xmlSchema *xmlSchemaPtr;
       
    86 
       
    87 /**
       
    88  * A schemas validation context
       
    89  */
       
    90 typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
       
    91 typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
       
    92 
       
    93 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
       
    94 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
       
    95 
       
    96 typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
       
    97 typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
       
    98 
       
    99 /*
       
   100  * Interfaces for parsing.
       
   101  */
       
   102 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL 
       
   103 	    xmlSchemaNewParserCtxt	(const char *URL);
       
   104 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL 
       
   105 	    xmlSchemaNewMemParserCtxt	(const char *buffer,
       
   106 					 int size);
       
   107 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
       
   108 	    xmlSchemaNewDocParserCtxt	(xmlDocPtr doc);
       
   109 XMLPUBFUN void XMLCALL		
       
   110 	    xmlSchemaFreeParserCtxt	(xmlSchemaParserCtxtPtr ctxt);
       
   111 XMLPUBFUN void XMLCALL		
       
   112 	    xmlSchemaSetParserErrors	(xmlSchemaParserCtxtPtr ctxt,
       
   113 					 xmlSchemaValidityErrorFunc err,
       
   114 					 xmlSchemaValidityWarningFunc warn,
       
   115 					 void *ctx);
       
   116 XMLPUBFUN void XMLCALL
       
   117 	    xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
       
   118 					 xmlStructuredErrorFunc serror,
       
   119 					 void *ctx);
       
   120 XMLPUBFUN int XMLCALL
       
   121 		xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
       
   122 					xmlSchemaValidityErrorFunc * err,
       
   123 					xmlSchemaValidityWarningFunc * warn,
       
   124 					void **ctx);
       
   125 XMLPUBFUN int XMLCALL
       
   126 		xmlSchemaIsValid	(xmlSchemaValidCtxtPtr ctxt);
       
   127 
       
   128 XMLPUBFUN xmlSchemaPtr XMLCALL	
       
   129 	    xmlSchemaParse		(xmlSchemaParserCtxtPtr ctxt);
       
   130 XMLPUBFUN void XMLCALL		
       
   131 	    xmlSchemaFree		(xmlSchemaPtr schema);
       
   132 #ifdef LIBXML_OUTPUT_ENABLED
       
   133 XMLPUBFUN void XMLCALL		
       
   134 	    xmlSchemaDump		(FILE *output,
       
   135 					 xmlSchemaPtr schema);
       
   136 #endif /* LIBXML_OUTPUT_ENABLED */
       
   137 /*
       
   138  * Interfaces for validating
       
   139  */
       
   140 XMLPUBFUN void XMLCALL		
       
   141 	    xmlSchemaSetValidErrors	(xmlSchemaValidCtxtPtr ctxt,
       
   142 					 xmlSchemaValidityErrorFunc err,
       
   143 					 xmlSchemaValidityWarningFunc warn,
       
   144 					 void *ctx);
       
   145 XMLPUBFUN void XMLCALL
       
   146 	    xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
       
   147 					 xmlStructuredErrorFunc serror,
       
   148 					 void *ctx);
       
   149 XMLPUBFUN int XMLCALL
       
   150 	    xmlSchemaGetValidErrors	(xmlSchemaValidCtxtPtr ctxt,
       
   151 					 xmlSchemaValidityErrorFunc *err,
       
   152 					 xmlSchemaValidityWarningFunc *warn,
       
   153 					 void **ctx);
       
   154 XMLPUBFUN int XMLCALL
       
   155 	    xmlSchemaSetValidOptions	(xmlSchemaValidCtxtPtr ctxt,
       
   156 					 int options);
       
   157 XMLPUBFUN int XMLCALL
       
   158 	    xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
       
   159 
       
   160 XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL	
       
   161 	    xmlSchemaNewValidCtxt	(xmlSchemaPtr schema);
       
   162 XMLPUBFUN void XMLCALL			
       
   163 	    xmlSchemaFreeValidCtxt	(xmlSchemaValidCtxtPtr ctxt);
       
   164 XMLPUBFUN int XMLCALL			
       
   165 	    xmlSchemaValidateDoc	(xmlSchemaValidCtxtPtr ctxt,
       
   166 					 xmlDocPtr instance);
       
   167 XMLPUBFUN int XMLCALL
       
   168             xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
       
   169 			                 xmlNodePtr elem);
       
   170 XMLPUBFUN int XMLCALL
       
   171 	    xmlSchemaValidateStream	(xmlSchemaValidCtxtPtr ctxt,
       
   172 					 xmlParserInputBufferPtr input,
       
   173 					 xmlCharEncoding enc,
       
   174 					 xmlSAXHandlerPtr sax,
       
   175 					 void *user_data);
       
   176 XMLPUBFUN int XMLCALL
       
   177 	    xmlSchemaValidateFile	(xmlSchemaValidCtxtPtr ctxt,
       
   178 					 const char * filename,
       
   179 					 int options);
       
   180 
       
   181 /*
       
   182  * Interface to insert Schemas SAX velidation in a SAX stream
       
   183  */
       
   184 typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
       
   185 typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
       
   186 
       
   187 XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
       
   188             xmlSchemaSAXPlug		(xmlSchemaValidCtxtPtr ctxt,
       
   189 					 xmlSAXHandlerPtr *sax,
       
   190 					 void **user_data);
       
   191 XMLPUBFUN int XMLCALL
       
   192             xmlSchemaSAXUnplug		(xmlSchemaSAXPlugPtr plug);
       
   193 #ifdef __cplusplus
       
   194 }
       
   195 #endif
       
   196 
       
   197 #endif /* LIBXML_SCHEMAS_ENABLED */
       
   198 #endif /* __XML_SCHEMA_H__ */