Annotation of embedaddon/libxml2/include/libxml/xmlschemas.h, revision 1.1.1.1
1.1 misho 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 <libxml/xmlversion.h>
16:
17: #ifdef LIBXML_SCHEMAS_ENABLED
18:
19: #include <libxml/tree.h>
20:
21: #ifdef __cplusplus
22: extern "C" {
23: #endif
24:
25: /**
26: * This error codes are obsolete; not used any more.
27: */
28: typedef enum {
29: XML_SCHEMAS_ERR_OK = 0,
30: XML_SCHEMAS_ERR_NOROOT = 1,
31: XML_SCHEMAS_ERR_UNDECLAREDELEM,
32: XML_SCHEMAS_ERR_NOTTOPLEVEL,
33: XML_SCHEMAS_ERR_MISSING,
34: XML_SCHEMAS_ERR_WRONGELEM,
35: XML_SCHEMAS_ERR_NOTYPE,
36: XML_SCHEMAS_ERR_NOROLLBACK,
37: XML_SCHEMAS_ERR_ISABSTRACT,
38: XML_SCHEMAS_ERR_NOTEMPTY,
39: XML_SCHEMAS_ERR_ELEMCONT,
40: XML_SCHEMAS_ERR_HAVEDEFAULT,
41: XML_SCHEMAS_ERR_NOTNILLABLE,
42: XML_SCHEMAS_ERR_EXTRACONTENT,
43: XML_SCHEMAS_ERR_INVALIDATTR,
44: XML_SCHEMAS_ERR_INVALIDELEM,
45: XML_SCHEMAS_ERR_NOTDETERMINIST,
46: XML_SCHEMAS_ERR_CONSTRUCT,
47: XML_SCHEMAS_ERR_INTERNAL,
48: XML_SCHEMAS_ERR_NOTSIMPLE,
49: XML_SCHEMAS_ERR_ATTRUNKNOWN,
50: XML_SCHEMAS_ERR_ATTRINVALID,
51: XML_SCHEMAS_ERR_VALUE,
52: XML_SCHEMAS_ERR_FACET,
53: XML_SCHEMAS_ERR_,
54: XML_SCHEMAS_ERR_XXX
55: } xmlSchemaValidError;
56:
57: /*
58: * ATTENTION: Change xmlSchemaSetValidOptions's check
59: * for invalid values, if adding to the validation
60: * options below.
61: */
62: /**
63: * xmlSchemaValidOption:
64: *
65: * This is the set of XML Schema validation options.
66: */
67: typedef enum {
68: XML_SCHEMA_VAL_VC_I_CREATE = 1<<0
69: /* Default/fixed: create an attribute node
70: * or an element's text node on the instance.
71: */
72: } xmlSchemaValidOption;
73:
74: /*
75: XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,
76: * assemble schemata using
77: * xsi:schemaLocation and
78: * xsi:noNamespaceSchemaLocation
79: */
80:
81: /**
82: * The schemas related types are kept internal
83: */
84: typedef struct _xmlSchema xmlSchema;
85: typedef xmlSchema *xmlSchemaPtr;
86:
87: /**
88: * xmlSchemaValidityErrorFunc:
89: * @ctx: the validation context
90: * @msg: the message
91: * @...: extra arguments
92: *
93: * Signature of an error callback from an XSD validation
94: */
95: typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
96:
97: /**
98: * xmlSchemaValidityWarningFunc:
99: * @ctx: the validation context
100: * @msg: the message
101: * @...: extra arguments
102: *
103: * Signature of a warning callback from an XSD validation
104: */
105: typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
106:
107: /**
108: * A schemas validation context
109: */
110: typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
111: typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
112:
113: typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
114: typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
115:
116: /*
117: * Interfaces for parsing.
118: */
119: XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
120: xmlSchemaNewParserCtxt (const char *URL);
121: XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
122: xmlSchemaNewMemParserCtxt (const char *buffer,
123: int size);
124: XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
125: xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
126: XMLPUBFUN void XMLCALL
127: xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
128: XMLPUBFUN void XMLCALL
129: xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
130: xmlSchemaValidityErrorFunc err,
131: xmlSchemaValidityWarningFunc warn,
132: void *ctx);
133: XMLPUBFUN void XMLCALL
134: xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
135: xmlStructuredErrorFunc serror,
136: void *ctx);
137: XMLPUBFUN int XMLCALL
138: xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
139: xmlSchemaValidityErrorFunc * err,
140: xmlSchemaValidityWarningFunc * warn,
141: void **ctx);
142: XMLPUBFUN int XMLCALL
143: xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
144:
145: XMLPUBFUN xmlSchemaPtr XMLCALL
146: xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
147: XMLPUBFUN void XMLCALL
148: xmlSchemaFree (xmlSchemaPtr schema);
149: #ifdef LIBXML_OUTPUT_ENABLED
150: XMLPUBFUN void XMLCALL
151: xmlSchemaDump (FILE *output,
152: xmlSchemaPtr schema);
153: #endif /* LIBXML_OUTPUT_ENABLED */
154: /*
155: * Interfaces for validating
156: */
157: XMLPUBFUN void XMLCALL
158: xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
159: xmlSchemaValidityErrorFunc err,
160: xmlSchemaValidityWarningFunc warn,
161: void *ctx);
162: XMLPUBFUN void XMLCALL
163: xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
164: xmlStructuredErrorFunc serror,
165: void *ctx);
166: XMLPUBFUN int XMLCALL
167: xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
168: xmlSchemaValidityErrorFunc *err,
169: xmlSchemaValidityWarningFunc *warn,
170: void **ctx);
171: XMLPUBFUN int XMLCALL
172: xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
173: int options);
174: XMLPUBFUN int XMLCALL
175: xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
176:
177: XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
178: xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
179: XMLPUBFUN void XMLCALL
180: xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
181: XMLPUBFUN int XMLCALL
182: xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
183: xmlDocPtr instance);
184: XMLPUBFUN int XMLCALL
185: xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
186: xmlNodePtr elem);
187: XMLPUBFUN int XMLCALL
188: xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
189: xmlParserInputBufferPtr input,
190: xmlCharEncoding enc,
191: xmlSAXHandlerPtr sax,
192: void *user_data);
193: XMLPUBFUN int XMLCALL
194: xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
195: const char * filename,
196: int options);
197:
198: XMLPUBFUN xmlParserCtxtPtr XMLCALL
199: xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
200:
201: /*
202: * Interface to insert Schemas SAX validation in a SAX stream
203: */
204: typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
205: typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
206:
207: XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
208: xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
209: xmlSAXHandlerPtr *sax,
210: void **user_data);
211: XMLPUBFUN int XMLCALL
212: xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
213: #ifdef __cplusplus
214: }
215: #endif
216:
217: #endif /* LIBXML_SCHEMAS_ENABLED */
218: #endif /* __XML_SCHEMA_H__ */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>