Debian Codegraph @

include/libxml/schematron.h

raw
1 /**
2 * @file
3 *
4 * @brief XML Schematron implementation
5 *
6 * interface to the XML Schematron validity checking.
7 *
8 * @copyright See Copyright for the status of this software.
9 *
10 * @author Daniel Veillard
11 */
12
13
14 #ifndef __XML_SCHEMATRON_H__
15 #define __XML_SCHEMATRON_H__
16
17 #include <libxml/xmlversion.h>
18
19 #ifdef LIBXML_SCHEMATRON_ENABLED
20
21 #include <libxml/xmlerror.h>
22 #include <libxml/tree.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29 * Schematron validation options
30 */
31 typedef enum {
32 /** quiet no report */
33 XML_SCHEMATRON_OUT_QUIET = 1 << 0,
34 /** build a textual report */
35 XML_SCHEMATRON_OUT_TEXT = 1 << 1,
36 /** output SVRL */
37 XML_SCHEMATRON_OUT_XML = 1 << 2,
38 /** output via xmlStructuredErrorFunc */
39 XML_SCHEMATRON_OUT_ERROR = 1 << 3,
40 /** output to a file descriptor */
41 XML_SCHEMATRON_OUT_FILE = 1 << 8,
42 /** output to a buffer */
43 XML_SCHEMATRON_OUT_BUFFER = 1 << 9,
44 /** output to I/O mechanism */
45 XML_SCHEMATRON_OUT_IO = 1 << 10
46 } xmlSchematronValidOptions;
47
48 /** Schematron schema */
49 typedef struct _xmlSchematron xmlSchematron;
50 typedef xmlSchematron *xmlSchematronPtr;
51
52 /**
53 * Signature of an error callback from a Schematron validation
54 *
55 * @param ctx the validation context
56 * @param msg the message
57 * @param ... extra arguments
58 */
59 typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
60
61 /**
62 * Signature of a warning callback from a Schematron validation
63 *
64 * @param ctx the validation context
65 * @param msg the message
66 * @param ... extra arguments
67 */
68 typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
69
70 /** Schematron parser context */
71 typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
72 typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
73
74 /** Schematron validation context */
75 typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
76 typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
77
78 /*
79 * Interfaces for parsing.
80 */
81 XMLPUBFUN xmlSchematronParserCtxt *
82 xmlSchematronNewParserCtxt (const char *URL);
83 XMLPUBFUN xmlSchematronParserCtxt *
84 xmlSchematronNewMemParserCtxt(const char *buffer,
85 int size);
86 XMLPUBFUN xmlSchematronParserCtxt *
87 xmlSchematronNewDocParserCtxt(xmlDoc *doc);
88 XMLPUBFUN void
89 xmlSchematronFreeParserCtxt (xmlSchematronParserCtxt *ctxt);
90 /*****
91 XMLPUBFUN void
92 xmlSchematronSetParserErrors(xmlSchematronParserCtxt *ctxt,
93 xmlSchematronValidityErrorFunc err,
94 xmlSchematronValidityWarningFunc warn,
95 void *ctx);
96 XMLPUBFUN int
97 xmlSchematronGetParserErrors(xmlSchematronParserCtxt *ctxt,
98 xmlSchematronValidityErrorFunc * err,
99 xmlSchematronValidityWarningFunc * warn,
100 void **ctx);
101 XMLPUBFUN int
102 xmlSchematronIsValid (xmlSchematronValidCtxt *ctxt);
103 *****/
104 XMLPUBFUN xmlSchematron *
105 xmlSchematronParse (xmlSchematronParserCtxt *ctxt);
106 XMLPUBFUN void
107 xmlSchematronFree (xmlSchematron *schema);
108 /*
109 * Interfaces for validating
110 */
111 XMLPUBFUN void
112 xmlSchematronSetValidStructuredErrors(
113 xmlSchematronValidCtxt *ctxt,
114 xmlStructuredErrorFunc serror,
115 void *ctx);
116 /******
117 XMLPUBFUN void
118 xmlSchematronSetValidErrors (xmlSchematronValidCtxt *ctxt,
119 xmlSchematronValidityErrorFunc err,
120 xmlSchematronValidityWarningFunc warn,
121 void *ctx);
122 XMLPUBFUN int
123 xmlSchematronGetValidErrors (xmlSchematronValidCtxt *ctxt,
124 xmlSchematronValidityErrorFunc *err,
125 xmlSchematronValidityWarningFunc *warn,
126 void **ctx);
127 XMLPUBFUN int
128 xmlSchematronSetValidOptions(xmlSchematronValidCtxt *ctxt,
129 int options);
130 XMLPUBFUN int
131 xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxt *ctxt);
132 XMLPUBFUN int
133 xmlSchematronValidateOneElement (xmlSchematronValidCtxt *ctxt,
134 xmlNode *elem);
135 *******/
136
137 XMLPUBFUN xmlSchematronValidCtxt *
138 xmlSchematronNewValidCtxt (xmlSchematron *schema,
139 int options);
140 XMLPUBFUN void
141 xmlSchematronFreeValidCtxt (xmlSchematronValidCtxt *ctxt);
142 XMLPUBFUN int
143 xmlSchematronValidateDoc (xmlSchematronValidCtxt *ctxt,
144 xmlDoc *instance);
145
146 #ifdef __cplusplus
147 }
148 #endif
149
150 #endif /* LIBXML_SCHEMATRON_ENABLED */
151 #endif /* __XML_SCHEMATRON_H__ */