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