|
1 /* |
|
2 * Summary: incomplete XML Schemas structure implementation |
|
3 * Description: interface to the XML Schemas handling and schema validity |
|
4 * checking, it is incomplete right now. |
|
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 "Libxml2_xmlversion.h" |
|
16 |
|
17 #ifdef LIBXML_SCHEMAS_ENABLED |
|
18 |
|
19 #include "Libxml2_tree.h" |
|
20 |
|
21 #ifdef __cplusplus |
|
22 extern "C" { |
|
23 #endif |
|
24 |
|
25 typedef enum { |
|
26 XML_SCHEMAS_ERR_OK = 0, |
|
27 XML_SCHEMAS_ERR_NOROOT = 1, |
|
28 XML_SCHEMAS_ERR_UNDECLAREDELEM, |
|
29 XML_SCHEMAS_ERR_NOTTOPLEVEL, |
|
30 XML_SCHEMAS_ERR_MISSING, |
|
31 XML_SCHEMAS_ERR_WRONGELEM, |
|
32 XML_SCHEMAS_ERR_NOTYPE, |
|
33 XML_SCHEMAS_ERR_NOROLLBACK, |
|
34 XML_SCHEMAS_ERR_ISABSTRACT, |
|
35 XML_SCHEMAS_ERR_NOTEMPTY, |
|
36 XML_SCHEMAS_ERR_ELEMCONT, |
|
37 XML_SCHEMAS_ERR_HAVEDEFAULT, |
|
38 XML_SCHEMAS_ERR_NOTNILLABLE, |
|
39 XML_SCHEMAS_ERR_EXTRACONTENT, |
|
40 XML_SCHEMAS_ERR_INVALIDATTR, |
|
41 XML_SCHEMAS_ERR_INVALIDELEM, |
|
42 XML_SCHEMAS_ERR_NOTDETERMINIST, |
|
43 XML_SCHEMAS_ERR_CONSTRUCT, |
|
44 XML_SCHEMAS_ERR_INTERNAL, |
|
45 XML_SCHEMAS_ERR_NOTSIMPLE, |
|
46 XML_SCHEMAS_ERR_ATTRUNKNOWN, |
|
47 XML_SCHEMAS_ERR_ATTRINVALID, |
|
48 XML_SCHEMAS_ERR_VALUE, |
|
49 XML_SCHEMAS_ERR_FACET, |
|
50 XML_SCHEMAS_ERR_, |
|
51 XML_SCHEMAS_ERR_XXX |
|
52 } xmlSchemaValidError; |
|
53 |
|
54 |
|
55 /** |
|
56 * The schemas related types are kept internal |
|
57 */ |
|
58 typedef struct _xmlSchema xmlSchema; |
|
59 typedef xmlSchema *xmlSchemaPtr; |
|
60 |
|
61 /** |
|
62 * A schemas validation context |
|
63 */ |
|
64 typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...); |
|
65 typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...); |
|
66 |
|
67 typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; |
|
68 typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; |
|
69 |
|
70 typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; |
|
71 typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; |
|
72 |
|
73 /* |
|
74 * Interfaces for parsing. |
|
75 */ |
|
76 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL |
|
77 xmlSchemaNewParserCtxt (const char *URL); |
|
78 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL |
|
79 xmlSchemaNewMemParserCtxt (const char *buffer, |
|
80 int size); |
|
81 XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL |
|
82 xmlSchemaNewDocParserCtxt (xmlDocPtr doc); |
|
83 XMLPUBFUN void XMLCALL |
|
84 xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); |
|
85 XMLPUBFUN void XMLCALL |
|
86 xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, |
|
87 xmlSchemaValidityErrorFunc err, |
|
88 xmlSchemaValidityWarningFunc warn, |
|
89 void *ctx); |
|
90 XMLPUBFUN xmlSchemaPtr XMLCALL |
|
91 xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); |
|
92 XMLPUBFUN void XMLCALL |
|
93 xmlSchemaFree (xmlSchemaPtr schema); |
|
94 #ifdef LIBXML_OUTPUT_ENABLED |
|
95 XMLPUBFUN void XMLCALL |
|
96 xmlSchemaDump (FILE *output, |
|
97 xmlSchemaPtr schema); |
|
98 #endif /* LIBXML_OUTPUT_ENABLED */ |
|
99 /* |
|
100 * Interfaces for validating |
|
101 */ |
|
102 XMLPUBFUN void XMLCALL |
|
103 xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, |
|
104 xmlSchemaValidityErrorFunc err, |
|
105 xmlSchemaValidityWarningFunc warn, |
|
106 void *ctx); |
|
107 XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL |
|
108 xmlSchemaNewValidCtxt (xmlSchemaPtr schema); |
|
109 XMLPUBFUN void XMLCALL |
|
110 xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); |
|
111 XMLPUBFUN int XMLCALL |
|
112 xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, |
|
113 xmlDocPtr instance); |
|
114 XMLPUBFUN int XMLCALL |
|
115 xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, |
|
116 xmlParserInputBufferPtr input, |
|
117 xmlCharEncoding enc, |
|
118 xmlSAXHandlerPtr sax, |
|
119 void *user_data); |
|
120 #ifdef __cplusplus |
|
121 } |
|
122 #endif |
|
123 |
|
124 #endif /* LIBXML_SCHEMAS_ENABLED */ |
|
125 #endif /* __XML_SCHEMA_H__ */ |