xmlschemas.h

Go to the documentation of this file.
00001 /*
00002  * Summary: incomplete XML Schemas structure implementation
00003  * Description: interface to the XML Schemas handling and schema validity
00004  *              checking, it is incomplete right now.
00005  *
00006  * Copy: See Copyright for the status of this software.
00007  *
00008  * Author: Daniel Veillard
00009  */
00010 
00011 
00012 #ifndef __XML_SCHEMA_H__
00013 #define __XML_SCHEMA_H__
00014 
00015 #include <libxml/xmlversion.h>
00016 
00017 #ifdef LIBXML_SCHEMAS_ENABLED
00018 
00019 #include <libxml/tree.h>
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00028 typedef enum {
00029     XML_SCHEMAS_ERR_OK      = 0,
00030     XML_SCHEMAS_ERR_NOROOT  = 1,
00031     XML_SCHEMAS_ERR_UNDECLAREDELEM,
00032     XML_SCHEMAS_ERR_NOTTOPLEVEL,
00033     XML_SCHEMAS_ERR_MISSING,
00034     XML_SCHEMAS_ERR_WRONGELEM,
00035     XML_SCHEMAS_ERR_NOTYPE,
00036     XML_SCHEMAS_ERR_NOROLLBACK,
00037     XML_SCHEMAS_ERR_ISABSTRACT,
00038     XML_SCHEMAS_ERR_NOTEMPTY,
00039     XML_SCHEMAS_ERR_ELEMCONT,
00040     XML_SCHEMAS_ERR_HAVEDEFAULT,
00041     XML_SCHEMAS_ERR_NOTNILLABLE,
00042     XML_SCHEMAS_ERR_EXTRACONTENT,
00043     XML_SCHEMAS_ERR_INVALIDATTR,
00044     XML_SCHEMAS_ERR_INVALIDELEM,
00045     XML_SCHEMAS_ERR_NOTDETERMINIST,
00046     XML_SCHEMAS_ERR_CONSTRUCT,
00047     XML_SCHEMAS_ERR_INTERNAL,
00048     XML_SCHEMAS_ERR_NOTSIMPLE,
00049     XML_SCHEMAS_ERR_ATTRUNKNOWN,
00050     XML_SCHEMAS_ERR_ATTRINVALID,
00051     XML_SCHEMAS_ERR_VALUE,
00052     XML_SCHEMAS_ERR_FACET,
00053     XML_SCHEMAS_ERR_,
00054     XML_SCHEMAS_ERR_XXX
00055 } xmlSchemaValidError;
00056 
00057 /*
00058 * ATTENTION: Change xmlSchemaSetValidOptions's check
00059 * for invalid values, if adding to the validation 
00060 * options below.
00061 */
00067 typedef enum {
00068     XML_SCHEMA_VAL_VC_I_CREATE          = 1<<0
00069     /* Default/fixed: create an attribute node
00070     * or an element's text node on the instance.
00071     */
00072 } xmlSchemaValidOption;
00073 
00074 /*
00075     XML_SCHEMA_VAL_XSI_ASSEMBLE         = 1<<1,
00076     * assemble schemata using
00077     * xsi:schemaLocation and
00078     * xsi:noNamespaceSchemaLocation
00079 */
00080 
00084 typedef struct _xmlSchema xmlSchema;
00085 typedef xmlSchema *xmlSchemaPtr;
00086 
00090 typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
00091 typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
00092 
00093 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
00094 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
00095 
00096 typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
00097 typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
00098 
00099 /*
00100  * Interfaces for parsing.
00101  */
00102 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL 
00103         xmlSchemaNewParserCtxt  (const char *URL);
00104 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL 
00105         xmlSchemaNewMemParserCtxt   (const char *buffer,
00106                      int size);
00107 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
00108         xmlSchemaNewDocParserCtxt   (xmlDocPtr doc);
00109 XMLPUBFUN void XMLCALL      
00110         xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
00111 XMLPUBFUN void XMLCALL      
00112         xmlSchemaSetParserErrors    (xmlSchemaParserCtxtPtr ctxt,
00113                      xmlSchemaValidityErrorFunc err,
00114                      xmlSchemaValidityWarningFunc warn,
00115                      void *ctx);
00116 XMLPUBFUN void XMLCALL
00117         xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
00118                      xmlStructuredErrorFunc serror,
00119                      void *ctx);
00120 XMLPUBFUN int XMLCALL
00121         xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
00122                     xmlSchemaValidityErrorFunc * err,
00123                     xmlSchemaValidityWarningFunc * warn,
00124                     void **ctx);
00125 XMLPUBFUN int XMLCALL
00126         xmlSchemaIsValid    (xmlSchemaValidCtxtPtr ctxt);
00127 
00128 XMLPUBFUN xmlSchemaPtr XMLCALL  
00129         xmlSchemaParse      (xmlSchemaParserCtxtPtr ctxt);
00130 XMLPUBFUN void XMLCALL      
00131         xmlSchemaFree       (xmlSchemaPtr schema);
00132 #ifdef LIBXML_OUTPUT_ENABLED
00133 XMLPUBFUN void XMLCALL      
00134         xmlSchemaDump       (FILE *output,
00135                      xmlSchemaPtr schema);
00136 #endif /* LIBXML_OUTPUT_ENABLED */
00137 /*
00138  * Interfaces for validating
00139  */
00140 XMLPUBFUN void XMLCALL      
00141         xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
00142                      xmlSchemaValidityErrorFunc err,
00143                      xmlSchemaValidityWarningFunc warn,
00144                      void *ctx);
00145 XMLPUBFUN void XMLCALL
00146         xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
00147                      xmlStructuredErrorFunc serror,
00148                      void *ctx);
00149 XMLPUBFUN int XMLCALL
00150         xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
00151                      xmlSchemaValidityErrorFunc *err,
00152                      xmlSchemaValidityWarningFunc *warn,
00153                      void **ctx);
00154 XMLPUBFUN int XMLCALL
00155         xmlSchemaSetValidOptions    (xmlSchemaValidCtxtPtr ctxt,
00156                      int options);
00157 XMLPUBFUN int XMLCALL
00158         xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
00159 
00160 XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL 
00161         xmlSchemaNewValidCtxt   (xmlSchemaPtr schema);
00162 XMLPUBFUN void XMLCALL          
00163         xmlSchemaFreeValidCtxt  (xmlSchemaValidCtxtPtr ctxt);
00164 XMLPUBFUN int XMLCALL           
00165         xmlSchemaValidateDoc    (xmlSchemaValidCtxtPtr ctxt,
00166                      xmlDocPtr instance);
00167 XMLPUBFUN int XMLCALL
00168             xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
00169                              xmlNodePtr elem);
00170 XMLPUBFUN int XMLCALL
00171         xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
00172                      xmlParserInputBufferPtr input,
00173                      xmlCharEncoding enc,
00174                      xmlSAXHandlerPtr sax,
00175                      void *user_data);
00176 XMLPUBFUN int XMLCALL
00177         xmlSchemaValidateFile   (xmlSchemaValidCtxtPtr ctxt,
00178                      const char * filename,
00179                      int options);
00180 
00181 /*
00182  * Interface to insert Schemas SAX velidation in a SAX stream
00183  */
00184 typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
00185 typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
00186 
00187 XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
00188             xmlSchemaSAXPlug        (xmlSchemaValidCtxtPtr ctxt,
00189                      xmlSAXHandlerPtr *sax,
00190                      void **user_data);
00191 XMLPUBFUN int XMLCALL
00192             xmlSchemaSAXUnplug      (xmlSchemaSAXPlugPtr plug);
00193 #ifdef __cplusplus
00194 }
00195 #endif
00196 
00197 #endif /* LIBXML_SCHEMAS_ENABLED */
00198 #endif /* __XML_SCHEMA_H__ */
footer
 SourceForge.net Logo