|
1 /* |
|
2 * Summary: XML Schemastron implementation |
|
3 * Description: interface to the XML Schematron validity checking. |
|
4 * |
|
5 * Copy: See Copyright for the status of this software. |
|
6 * |
|
7 * Author: Daniel Veillard |
|
8 */ |
|
9 |
|
10 |
|
11 #ifndef __XML_SCHEMATRON_H__ |
|
12 #define __XML_SCHEMATRON_H__ |
|
13 |
|
14 #include <libxml/xmlversion.h> |
|
15 |
|
16 #ifdef LIBXML_SCHEMATRON_ENABLED |
|
17 |
|
18 #include <libxml/tree.h> |
|
19 |
|
20 #ifdef __cplusplus |
|
21 extern "C" { |
|
22 #endif |
|
23 |
|
24 typedef enum { |
|
25 XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ |
|
26 XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ |
|
27 XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ |
|
28 XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ |
|
29 XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ |
|
30 XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ |
|
31 } xmlSchematronValidOptions; |
|
32 |
|
33 /** |
|
34 * The schemas related types are kept internal |
|
35 */ |
|
36 typedef struct _xmlSchematron xmlSchematron; |
|
37 typedef xmlSchematron *xmlSchematronPtr; |
|
38 |
|
39 /** |
|
40 * A schemas validation context |
|
41 */ |
|
42 typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); |
|
43 typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); |
|
44 |
|
45 typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; |
|
46 typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; |
|
47 |
|
48 typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; |
|
49 typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; |
|
50 |
|
51 /* |
|
52 * Interfaces for parsing. |
|
53 */ |
|
54 XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL |
|
55 xmlSchematronNewParserCtxt (const char *URL); |
|
56 XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL |
|
57 xmlSchematronNewMemParserCtxt(const char *buffer, |
|
58 int size); |
|
59 XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL |
|
60 xmlSchematronNewDocParserCtxt(xmlDocPtr doc); |
|
61 XMLPUBFUN void XMLCALL |
|
62 xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); |
|
63 /***** |
|
64 XMLPUBFUN void XMLCALL |
|
65 xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, |
|
66 xmlSchematronValidityErrorFunc err, |
|
67 xmlSchematronValidityWarningFunc warn, |
|
68 void *ctx); |
|
69 XMLPUBFUN int XMLCALL |
|
70 xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, |
|
71 xmlSchematronValidityErrorFunc * err, |
|
72 xmlSchematronValidityWarningFunc * warn, |
|
73 void **ctx); |
|
74 XMLPUBFUN int XMLCALL |
|
75 xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); |
|
76 *****/ |
|
77 XMLPUBFUN xmlSchematronPtr XMLCALL |
|
78 xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); |
|
79 XMLPUBFUN void XMLCALL |
|
80 xmlSchematronFree (xmlSchematronPtr schema); |
|
81 /* |
|
82 * Interfaces for validating |
|
83 */ |
|
84 /****** |
|
85 XMLPUBFUN void XMLCALL |
|
86 xmlSchematronSetValidStructuredErrors( |
|
87 xmlSchematronValidCtxtPtr ctxt, |
|
88 xmlStructuredErrorFunc serror, |
|
89 void *ctx); |
|
90 XMLPUBFUN void XMLCALL |
|
91 xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, |
|
92 xmlSchematronValidityErrorFunc err, |
|
93 xmlSchematronValidityWarningFunc warn, |
|
94 void *ctx); |
|
95 XMLPUBFUN int XMLCALL |
|
96 xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, |
|
97 xmlSchematronValidityErrorFunc *err, |
|
98 xmlSchematronValidityWarningFunc *warn, |
|
99 void **ctx); |
|
100 XMLPUBFUN int XMLCALL |
|
101 xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, |
|
102 int options); |
|
103 XMLPUBFUN int XMLCALL |
|
104 xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); |
|
105 XMLPUBFUN int XMLCALL |
|
106 xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, |
|
107 xmlNodePtr elem); |
|
108 *******/ |
|
109 |
|
110 XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL |
|
111 xmlSchematronNewValidCtxt (xmlSchematronPtr schema, |
|
112 int options); |
|
113 XMLPUBFUN void XMLCALL |
|
114 xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); |
|
115 XMLPUBFUN int XMLCALL |
|
116 xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, |
|
117 xmlDocPtr instance); |
|
118 |
|
119 #ifdef __cplusplus |
|
120 } |
|
121 #endif |
|
122 |
|
123 #endif /* LIBXML_SCHEMATRON_ENABLED */ |
|
124 #endif /* __XML_SCHEMATRON_H__ */ |