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 21extern "C" { 22#endif 23 24typedef 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 */ 36typedef struct _xmlSchematron xmlSchematron; 37typedef xmlSchematron *xmlSchematronPtr; 38 39/** 40 * A schemas validation context 41 */ 42typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); 43typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); 44 45typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; 46typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; 47 48typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; 49typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; 50 51/* 52 * Interfaces for parsing. 53 */ 54XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL 55 xmlSchematronNewParserCtxt (const char *URL); 56XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL 57 xmlSchematronNewMemParserCtxt(const char *buffer, 58 int size); 59XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL 60 xmlSchematronNewDocParserCtxt(xmlDocPtr doc); 61XMLPUBFUN void XMLCALL 62 xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); 63/***** 64XMLPUBFUN void XMLCALL 65 xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, 66 xmlSchematronValidityErrorFunc err, 67 xmlSchematronValidityWarningFunc warn, 68 void *ctx); 69XMLPUBFUN int XMLCALL 70 xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, 71 xmlSchematronValidityErrorFunc * err, 72 xmlSchematronValidityWarningFunc * warn, 73 void **ctx); 74XMLPUBFUN int XMLCALL 75 xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); 76 *****/ 77XMLPUBFUN xmlSchematronPtr XMLCALL 78 xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); 79XMLPUBFUN void XMLCALL 80 xmlSchematronFree (xmlSchematronPtr schema); 81/* 82 * Interfaces for validating 83 */ 84/****** 85XMLPUBFUN void XMLCALL 86 xmlSchematronSetValidStructuredErrors( 87 xmlSchematronValidCtxtPtr ctxt, 88 xmlStructuredErrorFunc serror, 89 void *ctx); 90XMLPUBFUN void XMLCALL 91 xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, 92 xmlSchematronValidityErrorFunc err, 93 xmlSchematronValidityWarningFunc warn, 94 void *ctx); 95XMLPUBFUN int XMLCALL 96 xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, 97 xmlSchematronValidityErrorFunc *err, 98 xmlSchematronValidityWarningFunc *warn, 99 void **ctx); 100XMLPUBFUN int XMLCALL 101 xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, 102 int options); 103XMLPUBFUN int XMLCALL 104 xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); 105XMLPUBFUN int XMLCALL 106 xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, 107 xmlNodePtr elem); 108 *******/ 109 110XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL 111 xmlSchematronNewValidCtxt (xmlSchematronPtr schema, 112 int options); 113XMLPUBFUN void XMLCALL 114 xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); 115XMLPUBFUN 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__ */ 125