blob: a1a809a9b87e3b8e819093e025f912107bce3c07 [file] [log] [blame]
Daniel Veillarded6c5492005-07-23 15:00:22 +00001/*
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
21extern "C" {
22#endif
23
24#define XML_SCHEMATRON_NS BAD_CAST "http://purl.oclc.org/dsdl/schematron"
25
26typedef enum {
27 XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */
28 XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */
29 XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */
30 XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */
31 XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
32 XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
33} xmlSchematronValidOptions;
34
35/**
36 * The schemas related types are kept internal
37 */
38typedef struct _xmlSchematron xmlSchematron;
39typedef xmlSchematron *xmlSchematronPtr;
40
41/**
42 * A schemas validation context
43 */
44typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
45typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
46
47typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
48typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
49
50typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
51typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
52
53/*
54 * Interfaces for parsing.
55 */
56XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
57 xmlSchematronNewParserCtxt (const char *URL);
58XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
59 xmlSchematronNewMemParserCtxt(const char *buffer,
60 int size);
61XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
62 xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
63XMLPUBFUN void XMLCALL
64 xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
65XMLPUBFUN void XMLCALL
66 xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
67 xmlSchematronValidityErrorFunc err,
68 xmlSchematronValidityWarningFunc warn,
69 void *ctx);
70XMLPUBFUN int XMLCALL
71 xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
72 xmlSchematronValidityErrorFunc * err,
73 xmlSchematronValidityWarningFunc * warn,
74 void **ctx);
75XMLPUBFUN int XMLCALL
76 xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
77
78XMLPUBFUN xmlSchematronPtr XMLCALL
79 xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
80XMLPUBFUN void XMLCALL
81 xmlSchematronFree (xmlSchematronPtr schema);
82#ifdef LIBXML_OUTPUT_ENABLED
83XMLPUBFUN void XMLCALL
84 xmlSchematronDump (FILE *output,
85 xmlSchematronPtr schema);
86#endif /* LIBXML_OUTPUT_ENABLED */
87/*
88 * Interfaces for validating
89 */
90XMLPUBFUN void XMLCALL
91 xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
92 xmlSchematronValidityErrorFunc err,
93 xmlSchematronValidityWarningFunc warn,
94 void *ctx);
95XMLPUBFUN void XMLCALL
96 xmlSchematronSetValidStructuredErrors(xmlSchematronValidCtxtPtr ctxt,
97 xmlStructuredErrorFunc serror, void *ctx);
98XMLPUBFUN int XMLCALL
99 xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
100 xmlSchematronValidityErrorFunc *err,
101 xmlSchematronValidityWarningFunc *warn,
102 void **ctx);
103XMLPUBFUN int XMLCALL
104 xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
105 int options);
106XMLPUBFUN int XMLCALL
107 xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
108
109XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
110 xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
111 int options);
112XMLPUBFUN void XMLCALL
113 xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
114XMLPUBFUN int XMLCALL
115 xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
116 xmlDocPtr instance);
117XMLPUBFUN int XMLCALL
118 xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
119 xmlNodePtr elem);
120
121#ifdef __cplusplus
122}
123#endif
124
125#endif /* LIBXML_SCHEMATRON_ENABLED */
126#endif /* __XML_SCHEMATRON_H__ */