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{$IFDEF LIBXML_SCHEMAS_ENABLED}
12
13{$IFDEF POINTER}
14  xmlSchemaPtr = ^xmlSchema;
15  xmlSchemaParserCtxtPtr = ^xmlSchemaParserCtxt;
16  xmlSchemaValidCtxtPtr = ^xmlSchemaValidCtxt;
17  xmlSchemaSAXPlugPtr = ^xmlSchemaSAXPlugStruct;
18{$ENDIF}
19
20{$IFDEF TYPE}
21(**
22 * This error codes are obsolete; not used any more.
23 *)
24  xmlSchemaValidError = (
25    XML_SCHEMAS_ERR_OK		= 0,
26    XML_SCHEMAS_ERR_NOROOT	= 1,
27    XML_SCHEMAS_ERR_UNDECLAREDELEM,
28    XML_SCHEMAS_ERR_NOTTOPLEVEL,
29    XML_SCHEMAS_ERR_MISSING,
30    XML_SCHEMAS_ERR_WRONGELEM,
31    XML_SCHEMAS_ERR_NOTYPE,
32    XML_SCHEMAS_ERR_NOROLLBACK,
33    XML_SCHEMAS_ERR_ISABSTRACT,
34    XML_SCHEMAS_ERR_NOTEMPTY,
35    XML_SCHEMAS_ERR_ELEMCONT,
36    XML_SCHEMAS_ERR_HAVEDEFAULT,
37    XML_SCHEMAS_ERR_NOTNILLABLE,
38    XML_SCHEMAS_ERR_EXTRACONTENT,
39    XML_SCHEMAS_ERR_INVALIDATTR,
40    XML_SCHEMAS_ERR_INVALIDELEM,
41    XML_SCHEMAS_ERR_NOTDETERMINIST,
42    XML_SCHEMAS_ERR_CONSTRUCT,
43    XML_SCHEMAS_ERR_INTERNAL,
44    XML_SCHEMAS_ERR_NOTSIMPLE,
45    XML_SCHEMAS_ERR_ATTRUNKNOWN,
46    XML_SCHEMAS_ERR_ATTRINVALID,
47    XML_SCHEMAS_ERR_VALUE,
48    XML_SCHEMAS_ERR_FACET,
49    XML_SCHEMAS_ERR_,
50    XML_SCHEMAS_ERR_XXX
51  );
52
53(*
54* ATTENTION: Change xmlSchemaSetValidOptions's check
55* for invalid values, if adding to the validation
56* options below.
57*)
58(**
59 * xmlSchemaValidOption:
60 *
61 * This is the set of XML Schema validation options.
62 *)
63  xmlSchemaValidOption = type cint;
64{$ENDIF}
65
66{$IFDEF CONST}
67    XML_SCHEMA_VAL_VC_I_CREATE			= 1 shl 0;
68	(* Default/fixed: create an attribute node
69	* or an element's text node on the instance.
70	*)
71
72    XML_SCHEMA_VAL_XSI_ASSEMBLE			= 1 shl 1;
73(*
74	* assemble schemata using
75	* xsi:schemaLocation and
76	* xsi:noNamespaceSchemaLocation
77*)
78{$ENDIF}
79
80{$IFDEF TYPE}
81(**
82 * The schemas related types are kept internal
83 *)
84//  xmlSchema = record end;
85
86(**
87 * A schemas validation context
88 *)
89  xmlSchemaValidityErrorFunc = procedure(ctx: pointer; msg: pchar); cdecl; varargs;
90  xmlSchemaValidityWarningFunc = procedure(ctx: pointer; msg: pchar); cdecl; varargs;
91
92  xmlSchemaParserCtxt = record end;
93
94  xmlSchemaValidCtxt = record end;
95
96  xmlSchemaSAXPlugStruct = record end;
97{$ENDIF}
98
99{$IFDEF FUNCTION}
100(*
101 * Interfaces for parsing.
102 *)
103function xmlSchemaNewParserCtxt(URL: pchar): xmlSchemaParserCtxtPtr; EXTDECL; external xml2lib;
104function xmlSchemaNewMemParserCtxt(buffer: pchar; size: cint): xmlSchemaParserCtxtPtr; EXTDECL; external xml2lib;
105function xmlSchemaNewDocParserCtxt(doc: xmlDocPtr): xmlSchemaParserCtxtPtr; EXTDECL; external xml2lib;
106procedure xmlSchemaFreeParserCtxt(ctxt: xmlSchemaParserCtxtPtr); EXTDECL; external xml2lib;
107procedure xmlSchemaSetParserErrors(ctxt: xmlSchemaParserCtxtPtr; err: xmlSchemaValidityErrorFunc; warn: xmlSchemaValidityWarningFunc; ctx: pointer); EXTDECL; external xml2lib;
108procedure xmlSchemaSetParserStructuredErrors(ctxt: xmlSchemaParserCtxtPtr; serror: xmlStructuredErrorFunc; ctx: pointer); EXTDECL; external xml2lib;
109function xmlSchemaSetParserErrors(ctxt: xmlSchemaParserCtxtPtr; var err: xmlSchemaValidityErrorFunc; var warn: xmlSchemaValidityWarningFunc; var ctx: pointer): cint; EXTDECL; external xml2lib;
110function xmlSchemaIsValid(ctxt: xmlSchemaValidCtxtPtr): cint; EXTDECL; external xml2lib;
111function xmlSchemaParse(ctxt: xmlSchemaParserCtxtPtr): xmlSchemaPtr; EXTDECL; external xml2lib;
112procedure xmlSchemaFree(schema: xmlSchemaPtr); EXTDECL; external xml2lib;
113{$IFDEF LIBXML_OUTPUT_ENABLED}
114procedure xmlSchemaDump(output: PFILE; schema: xmlSchemaPtr); EXTDECL; external xml2lib;
115{$ENDIF} (* LIBXML_OUTPUT_ENABLED *)
116
117(*
118 * Interfaces for validating
119 *)
120procedure xmlSchemaSetValidErrors(ctxt: xmlSchemaParserCtxtPtr; err: xmlSchemaValidityErrorFunc; warn: xmlSchemaValidityWarningFunc; ctx: pointer); EXTDECL; external xml2lib;
121procedure xmlSchemaSetValidStructuredErrors(ctxt: xmlSchemaParserCtxtPtr; serror: xmlStructuredErrorFunc; ctx: pointer); EXTDECL; external xml2lib;
122function xmlSchemaGetValidErrors(ctxt: xmlSchemaParserCtxtPtr; var err: xmlSchemaValidityErrorFunc; var warn: xmlSchemaValidityWarningFunc; var ctx: pointer): cint; EXTDECL; external xml2lib;
123function xmlSchemaSetValidOptions(ctxt: xmlSchemaValidCtxtPtr; options: cint): cint; EXTDECL; external xml2lib;
124function xmlSchemaValidCtxtGetOptions(ctxt: xmlSchemaValidCtxtPtr): cint; EXTDECL; external xml2lib;
125function xmlSchemaNewValidCtxt(schema: xmlSchemaPtr): xmlSchemaValidCtxtPtr; EXTDECL; external xml2lib;
126procedure xmlSchemaFreeValidCtxt(ctxt: xmlSchemaValidCtxtPtr); EXTDECL; external xml2lib;
127function xmlSchemaNewValidCtxt(ctxt: xmlSchemaValidCtxtPtr; instance: xmlDocPtr): cint; EXTDECL; external xml2lib;
128function xmlSchemaValidateOneElement(ctxt: xmlSchemaValidCtxtPtr; elem: xmlNodePtr): cint; EXTDECL; external xml2lib;
129function xmlSchemaValidateStream(ctxt: xmlSchemaValidCtxtPtr; input: xmlParserInputBufferPtr; enc: xmlCharEncoding; sax: xmlSAXHandlerPtr; user_data: pointer): cint; EXTDECL; external xml2lib;
130function xmlSchemaValidateFile(ctxt: xmlSchemaValidCtxtPtr; filename: pchar; options: cint): cint; EXTDECL; external xml2lib;
131
132(*
133 * Interface to insert Schemas SAX velidation in a SAX stream
134 *)
135function xmlSchemaSAXPlug(ctxt: xmlSchemaValidCtxtPtr; var sax: xmlSchemaSAXPlugPtr; var user_data: pointer): xmlSchemaSAXPlugPtr; EXTDECL; external xml2lib;
136function xmlSchemaSAXUnplug(plug: xmlSchemaSAXPlugPtr): cint; EXTDECL; external xml2lib;
137{$ENDIF}
138
139{$ENDIF} (* LIBXML_SCHEMAS_ENABLED *)
140