blob: 364eaecde6b1bb161271c379d53e2c969b83b836 [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
Daniel Veillarded6c5492005-07-23 15:00:22 +000024typedef 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 */
Daniel Veillardc4b0deb2008-03-14 12:46:42 +000028 XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */
Daniel Veillarded6c5492005-07-23 15:00:22 +000029 XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */
30 XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
31 XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
32} xmlSchematronValidOptions;
33
34/**
35 * The schemas related types are kept internal
36 */
37typedef struct _xmlSchematron xmlSchematron;
38typedef xmlSchematron *xmlSchematronPtr;
39
40/**
Daniel Veillarddee23482008-04-11 12:58:43 +000041 * xmlSchematronValidityErrorFunc:
42 * @ctx: the validation context
43 * @msg: the message
44 * @...: extra arguments
45 *
46 * Signature of an error callback from a Schematron validation
Daniel Veillarded6c5492005-07-23 15:00:22 +000047 */
48typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
Daniel Veillarddee23482008-04-11 12:58:43 +000049
50/**
51 * xmlSchematronValidityWarningFunc:
52 * @ctx: the validation context
53 * @msg: the message
54 * @...: extra arguments
55 *
56 * Signature of a warning callback from a Schematron validation
57 */
Daniel Veillarded6c5492005-07-23 15:00:22 +000058typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
59
Daniel Veillarddee23482008-04-11 12:58:43 +000060/**
61 * A schemas validation context
62 */
Daniel Veillarded6c5492005-07-23 15:00:22 +000063typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
64typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
65
66typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
67typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
68
69/*
70 * Interfaces for parsing.
71 */
Daniel Veillardf8e3db02012-09-11 13:26:36 +080072XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +000073 xmlSchematronNewParserCtxt (const char *URL);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080074XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +000075 xmlSchematronNewMemParserCtxt(const char *buffer,
76 int size);
77XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
78 xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080079XMLPUBFUN void XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +000080 xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
Daniel Veillard17cccb52005-08-23 13:49:54 +000081/*****
Daniel Veillardf8e3db02012-09-11 13:26:36 +080082XMLPUBFUN void XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +000083 xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
84 xmlSchematronValidityErrorFunc err,
85 xmlSchematronValidityWarningFunc warn,
86 void *ctx);
87XMLPUBFUN int XMLCALL
88 xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
89 xmlSchematronValidityErrorFunc * err,
90 xmlSchematronValidityWarningFunc * warn,
91 void **ctx);
92XMLPUBFUN int XMLCALL
93 xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
Daniel Veillard5eee7672005-08-22 21:22:27 +000094 *****/
Daniel Veillardf8e3db02012-09-11 13:26:36 +080095XMLPUBFUN xmlSchematronPtr XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +000096 xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
Daniel Veillardf8e3db02012-09-11 13:26:36 +080097XMLPUBFUN void XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +000098 xmlSchematronFree (xmlSchematronPtr schema);
Daniel Veillarded6c5492005-07-23 15:00:22 +000099/*
100 * Interfaces for validating
101 */
Daniel Veillarded6c5492005-07-23 15:00:22 +0000102XMLPUBFUN void XMLCALL
Daniel Veillard5eee7672005-08-22 21:22:27 +0000103 xmlSchematronSetValidStructuredErrors(
104 xmlSchematronValidCtxtPtr ctxt,
105 xmlStructuredErrorFunc serror,
106 void *ctx);
Daniel Veillardc4b0deb2008-03-14 12:46:42 +0000107/******
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800108XMLPUBFUN void XMLCALL
Daniel Veillard17cccb52005-08-23 13:49:54 +0000109 xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
110 xmlSchematronValidityErrorFunc err,
111 xmlSchematronValidityWarningFunc warn,
112 void *ctx);
Daniel Veillarded6c5492005-07-23 15:00:22 +0000113XMLPUBFUN int XMLCALL
114 xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
115 xmlSchematronValidityErrorFunc *err,
116 xmlSchematronValidityWarningFunc *warn,
117 void **ctx);
118XMLPUBFUN int XMLCALL
119 xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
120 int options);
121XMLPUBFUN int XMLCALL
122 xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
Daniel Veillard5eee7672005-08-22 21:22:27 +0000123XMLPUBFUN int XMLCALL
124 xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
125 xmlNodePtr elem);
126 *******/
Daniel Veillarded6c5492005-07-23 15:00:22 +0000127
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800128XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +0000129 xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800130 int options);
131XMLPUBFUN void XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +0000132 xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
Daniel Veillardf8e3db02012-09-11 13:26:36 +0800133XMLPUBFUN int XMLCALL
Daniel Veillarded6c5492005-07-23 15:00:22 +0000134 xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
135 xmlDocPtr instance);
Daniel Veillarded6c5492005-07-23 15:00:22 +0000136
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* LIBXML_SCHEMATRON_ENABLED */
142#endif /* __XML_SCHEMATRON_H__ */