xmlschemas.h

00001 /*
00002 
00003  * Summary: incomplete XML Schemas structure implementation
00004 
00005  * Description: interface to the XML Schemas handling and schema validity
00006 
00007  *              checking, it is incomplete right now.
00008 
00009  *
00010 
00011  * Copy: See Copyright for the status of this software.
00012 
00013  *
00014 
00015  * Author: Daniel Veillard
00016 
00017  */
00018 
00019 
00020 
00021 
00022 
00023 #ifndef __XML_SCHEMA_H__
00024 
00025 #define __XML_SCHEMA_H__
00026 
00027 
00028 
00029 #include <libxml/xmlversion.h>
00030 
00031 
00032 
00033 #ifdef LIBXML_SCHEMAS_ENABLED
00034 
00035 
00036 
00037 #include <libxml/tree.h>
00038 
00039 
00040 
00041 #ifdef __cplusplus
00042 
00043 extern "C" {
00044 
00045 #endif
00046 
00047 
00048 
00055 typedef enum {
00056 
00057     XML_SCHEMAS_ERR_OK          = 0,
00058 
00059     XML_SCHEMAS_ERR_NOROOT      = 1,
00060 
00061     XML_SCHEMAS_ERR_UNDECLAREDELEM,
00062 
00063     XML_SCHEMAS_ERR_NOTTOPLEVEL,
00064 
00065     XML_SCHEMAS_ERR_MISSING,
00066 
00067     XML_SCHEMAS_ERR_WRONGELEM,
00068 
00069     XML_SCHEMAS_ERR_NOTYPE,
00070 
00071     XML_SCHEMAS_ERR_NOROLLBACK,
00072 
00073     XML_SCHEMAS_ERR_ISABSTRACT,
00074 
00075     XML_SCHEMAS_ERR_NOTEMPTY,
00076 
00077     XML_SCHEMAS_ERR_ELEMCONT,
00078 
00079     XML_SCHEMAS_ERR_HAVEDEFAULT,
00080 
00081     XML_SCHEMAS_ERR_NOTNILLABLE,
00082 
00083     XML_SCHEMAS_ERR_EXTRACONTENT,
00084 
00085     XML_SCHEMAS_ERR_INVALIDATTR,
00086 
00087     XML_SCHEMAS_ERR_INVALIDELEM,
00088 
00089     XML_SCHEMAS_ERR_NOTDETERMINIST,
00090 
00091     XML_SCHEMAS_ERR_CONSTRUCT,
00092 
00093     XML_SCHEMAS_ERR_INTERNAL,
00094 
00095     XML_SCHEMAS_ERR_NOTSIMPLE,
00096 
00097     XML_SCHEMAS_ERR_ATTRUNKNOWN,
00098 
00099     XML_SCHEMAS_ERR_ATTRINVALID,
00100 
00101     XML_SCHEMAS_ERR_VALUE,
00102 
00103     XML_SCHEMAS_ERR_FACET,
00104 
00105     XML_SCHEMAS_ERR_,
00106 
00107     XML_SCHEMAS_ERR_XXX
00108 
00109 } xmlSchemaValidError;
00110 
00111 
00112 
00113 /*
00114 
00115 * ATTENTION: Change xmlSchemaSetValidOptions's check
00116 
00117 * for invalid values, if adding to the validation 
00118 
00119 * options below.
00120 
00121 */
00122 
00133 typedef enum {
00134 
00135     XML_SCHEMA_VAL_VC_I_CREATE                  = 1<<0
00136 
00137         /* Default/fixed: create an attribute node
00138 
00139         * or an element's text node on the instance.
00140 
00141         */
00142 
00143 } xmlSchemaValidOption;
00144 
00145 
00146 
00147 /*
00148 
00149     XML_SCHEMA_VAL_XSI_ASSEMBLE                 = 1<<1,
00150 
00151         * assemble schemata using
00152 
00153         * xsi:schemaLocation and
00154 
00155         * xsi:noNamespaceSchemaLocation
00156 
00157 */
00158 
00159 
00160 
00167 typedef struct _xmlSchema xmlSchema;
00168 
00169 typedef xmlSchema *xmlSchemaPtr;
00170 
00171 
00172 
00179 typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
00180 
00181 typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
00182 
00183 
00184 
00185 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
00186 
00187 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
00188 
00189 
00190 
00191 typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
00192 
00193 typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
00194 
00195 
00196 
00197 /*
00198 
00199  * Interfaces for parsing.
00200 
00201  */
00202 
00203 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL 
00204 
00205             xmlSchemaNewParserCtxt      (const char *URL);
00206 
00207 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL 
00208 
00209             xmlSchemaNewMemParserCtxt   (const char *buffer,
00210 
00211                                          int size);
00212 
00213 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
00214 
00215             xmlSchemaNewDocParserCtxt   (xmlDocPtr doc);
00216 
00217 XMLPUBFUN void XMLCALL          
00218 
00219             xmlSchemaFreeParserCtxt     (xmlSchemaParserCtxtPtr ctxt);
00220 
00221 XMLPUBFUN void XMLCALL          
00222 
00223             xmlSchemaSetParserErrors    (xmlSchemaParserCtxtPtr ctxt,
00224 
00225                                          xmlSchemaValidityErrorFunc err,
00226 
00227                                          xmlSchemaValidityWarningFunc warn,
00228 
00229                                          void *ctx);
00230 
00231 XMLPUBFUN int XMLCALL
00232 
00233                 xmlSchemaGetParserErrors        (xmlSchemaParserCtxtPtr ctxt,
00234 
00235                                         xmlSchemaValidityErrorFunc * err,
00236 
00237                                         xmlSchemaValidityWarningFunc * warn,
00238 
00239                                         void **ctx);
00240 
00241 XMLPUBFUN xmlSchemaPtr XMLCALL  
00242 
00243             xmlSchemaParse              (xmlSchemaParserCtxtPtr ctxt);
00244 
00245 XMLPUBFUN void XMLCALL          
00246 
00247             xmlSchemaFree               (xmlSchemaPtr schema);
00248 
00249 #ifdef LIBXML_OUTPUT_ENABLED
00250 
00251 XMLPUBFUN void XMLCALL          
00252 
00253             xmlSchemaDump               (FILE *output,
00254 
00255                                          xmlSchemaPtr schema);
00256 
00257 #endif /* LIBXML_OUTPUT_ENABLED */
00258 
00259 /*
00260 
00261  * Interfaces for validating
00262 
00263  */
00264 
00265 XMLPUBFUN void XMLCALL          
00266 
00267             xmlSchemaSetValidErrors     (xmlSchemaValidCtxtPtr ctxt,
00268 
00269                                          xmlSchemaValidityErrorFunc err,
00270 
00271                                          xmlSchemaValidityWarningFunc warn,
00272 
00273                                          void *ctx);
00274 
00275 XMLPUBFUN int XMLCALL
00276 
00277             xmlSchemaGetValidErrors     (xmlSchemaValidCtxtPtr ctxt,
00278 
00279                                          xmlSchemaValidityErrorFunc *err,
00280 
00281                                          xmlSchemaValidityWarningFunc *warn,
00282 
00283                                          void **ctx);
00284 
00285 XMLPUBFUN int XMLCALL
00286 
00287             xmlSchemaSetValidOptions    (xmlSchemaValidCtxtPtr ctxt,
00288 
00289                                          int options);
00290 
00291 XMLPUBFUN int XMLCALL
00292 
00293             xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
00294 
00295 
00296 
00297 XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL 
00298 
00299             xmlSchemaNewValidCtxt       (xmlSchemaPtr schema);
00300 
00301 XMLPUBFUN void XMLCALL                  
00302 
00303             xmlSchemaFreeValidCtxt      (xmlSchemaValidCtxtPtr ctxt);
00304 
00305 XMLPUBFUN int XMLCALL                   
00306 
00307             xmlSchemaValidateDoc        (xmlSchemaValidCtxtPtr ctxt,
00308 
00309                                          xmlDocPtr instance);
00310 
00311 XMLPUBFUN int XMLCALL
00312 
00313             xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
00314 
00315                                          xmlNodePtr elem);
00316 
00317 XMLPUBFUN int XMLCALL                   
00318 
00319             xmlSchemaValidateStream     (xmlSchemaValidCtxtPtr ctxt,
00320 
00321                                          xmlParserInputBufferPtr input,
00322 
00323                                          xmlCharEncoding enc,
00324 
00325                                          xmlSAXHandlerPtr sax,
00326 
00327                                          void *user_data);
00328 
00329 #ifdef __cplusplus
00330 
00331 }
00332 
00333 #endif
00334 
00335 
00336 
00337 #endif /* LIBXML_SCHEMAS_ENABLED */
00338 
00339 #endif /* __XML_SCHEMA_H__ */
00340 

Generated on Wed Jul 26 13:30:46 2006 for XSB by  doxygen 1.4.5