File indexing completed on 2025-02-22 10:41:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef __XML_SCHEMA_H__
0013 #define __XML_SCHEMA_H__
0014
0015 #include <libxml/xmlversion.h>
0016
0017 #ifdef LIBXML_SCHEMAS_ENABLED
0018
0019 #include <stdio.h>
0020 #include <libxml/encoding.h>
0021 #include <libxml/tree.h>
0022 #include <libxml/xmlerror.h>
0023
0024 #ifdef __cplusplus
0025 extern "C" {
0026 #endif
0027
0028
0029
0030
0031 typedef enum {
0032 XML_SCHEMAS_ERR_OK = 0,
0033 XML_SCHEMAS_ERR_NOROOT = 1,
0034 XML_SCHEMAS_ERR_UNDECLAREDELEM,
0035 XML_SCHEMAS_ERR_NOTTOPLEVEL,
0036 XML_SCHEMAS_ERR_MISSING,
0037 XML_SCHEMAS_ERR_WRONGELEM,
0038 XML_SCHEMAS_ERR_NOTYPE,
0039 XML_SCHEMAS_ERR_NOROLLBACK,
0040 XML_SCHEMAS_ERR_ISABSTRACT,
0041 XML_SCHEMAS_ERR_NOTEMPTY,
0042 XML_SCHEMAS_ERR_ELEMCONT,
0043 XML_SCHEMAS_ERR_HAVEDEFAULT,
0044 XML_SCHEMAS_ERR_NOTNILLABLE,
0045 XML_SCHEMAS_ERR_EXTRACONTENT,
0046 XML_SCHEMAS_ERR_INVALIDATTR,
0047 XML_SCHEMAS_ERR_INVALIDELEM,
0048 XML_SCHEMAS_ERR_NOTDETERMINIST,
0049 XML_SCHEMAS_ERR_CONSTRUCT,
0050 XML_SCHEMAS_ERR_INTERNAL,
0051 XML_SCHEMAS_ERR_NOTSIMPLE,
0052 XML_SCHEMAS_ERR_ATTRUNKNOWN,
0053 XML_SCHEMAS_ERR_ATTRINVALID,
0054 XML_SCHEMAS_ERR_VALUE,
0055 XML_SCHEMAS_ERR_FACET,
0056 XML_SCHEMAS_ERR_,
0057 XML_SCHEMAS_ERR_XXX
0058 } xmlSchemaValidError;
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070 typedef enum {
0071 XML_SCHEMA_VAL_VC_I_CREATE = 1<<0
0072
0073
0074
0075 } xmlSchemaValidOption;
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087 typedef struct _xmlSchema xmlSchema;
0088 typedef xmlSchema *xmlSchemaPtr;
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098 typedef void (*xmlSchemaValidityErrorFunc)
0099 (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109 typedef void (*xmlSchemaValidityWarningFunc)
0110 (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
0111
0112
0113
0114
0115 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
0116 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
0117
0118 typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
0119 typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134 typedef int (*xmlSchemaValidityLocatorFunc) (void *ctx,
0135 const char **file, unsigned long *line);
0136
0137
0138
0139
0140 XMLPUBFUN xmlSchemaParserCtxtPtr
0141 xmlSchemaNewParserCtxt (const char *URL);
0142 XMLPUBFUN xmlSchemaParserCtxtPtr
0143 xmlSchemaNewMemParserCtxt (const char *buffer,
0144 int size);
0145 XMLPUBFUN xmlSchemaParserCtxtPtr
0146 xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
0147 XMLPUBFUN void
0148 xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
0149 XMLPUBFUN void
0150 xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
0151 xmlSchemaValidityErrorFunc err,
0152 xmlSchemaValidityWarningFunc warn,
0153 void *ctx);
0154 XMLPUBFUN void
0155 xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
0156 xmlStructuredErrorFunc serror,
0157 void *ctx);
0158 XMLPUBFUN int
0159 xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
0160 xmlSchemaValidityErrorFunc * err,
0161 xmlSchemaValidityWarningFunc * warn,
0162 void **ctx);
0163 XMLPUBFUN int
0164 xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
0165
0166 XMLPUBFUN xmlSchemaPtr
0167 xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
0168 XMLPUBFUN void
0169 xmlSchemaFree (xmlSchemaPtr schema);
0170 #ifdef LIBXML_OUTPUT_ENABLED
0171 XMLPUBFUN void
0172 xmlSchemaDump (FILE *output,
0173 xmlSchemaPtr schema);
0174 #endif
0175
0176
0177
0178 XMLPUBFUN void
0179 xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
0180 xmlSchemaValidityErrorFunc err,
0181 xmlSchemaValidityWarningFunc warn,
0182 void *ctx);
0183 XMLPUBFUN void
0184 xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
0185 xmlStructuredErrorFunc serror,
0186 void *ctx);
0187 XMLPUBFUN int
0188 xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
0189 xmlSchemaValidityErrorFunc *err,
0190 xmlSchemaValidityWarningFunc *warn,
0191 void **ctx);
0192 XMLPUBFUN int
0193 xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
0194 int options);
0195 XMLPUBFUN void
0196 xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt,
0197 const char *filename);
0198 XMLPUBFUN int
0199 xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
0200
0201 XMLPUBFUN xmlSchemaValidCtxtPtr
0202 xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
0203 XMLPUBFUN void
0204 xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
0205 XMLPUBFUN int
0206 xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
0207 xmlDocPtr instance);
0208 XMLPUBFUN int
0209 xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
0210 xmlNodePtr elem);
0211 XMLPUBFUN int
0212 xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
0213 xmlParserInputBufferPtr input,
0214 xmlCharEncoding enc,
0215 xmlSAXHandlerPtr sax,
0216 void *user_data);
0217 XMLPUBFUN int
0218 xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
0219 const char * filename,
0220 int options);
0221
0222 XMLPUBFUN xmlParserCtxtPtr
0223 xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
0224
0225
0226
0227
0228 typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
0229 typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
0230
0231 XMLPUBFUN xmlSchemaSAXPlugPtr
0232 xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
0233 xmlSAXHandlerPtr *sax,
0234 void **user_data);
0235 XMLPUBFUN int
0236 xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
0237
0238
0239 XMLPUBFUN void
0240 xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt,
0241 xmlSchemaValidityLocatorFunc f,
0242 void *ctxt);
0243
0244 #ifdef __cplusplus
0245 }
0246 #endif
0247
0248 #endif
0249 #endif