codekingpro/portable-devtools
114k
1/*2 * Summary: XML Schematron implementation3 * Description: interface to the XML Schematron validity checking.4 *5 * Copy: See Copyright for the status of this software.6 *7 * Author: Daniel Veillard8 */9 10 11#ifndef __XML_SCHEMATRON_H__12#define __XML_SCHEMATRON_H__13 14#include <libxml/xmlversion.h>15 16#ifdef LIBXML_SCHEMATRON_ENABLED17 18#include <libxml/tree.h>19 20#ifdef __cplusplus21extern "C" {22#endif23 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_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */29 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 internal36 */37typedef struct _xmlSchematron xmlSchematron;38typedef xmlSchematron *xmlSchematronPtr;39 40/**41 * xmlSchematronValidityErrorFunc:42 * @ctx: the validation context43 * @msg: the message44 * @...: extra arguments45 *46 * Signature of an error callback from a Schematron validation47 */48typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);49 50/**51 * xmlSchematronValidityWarningFunc:52 * @ctx: the validation context53 * @msg: the message54 * @...: extra arguments55 *56 * Signature of a warning callback from a Schematron validation57 */58typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);59 60/**61 * A schemas validation context62 */63typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;64typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;65 66typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;67typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;68 69/*70 * Interfaces for parsing.71 */72XMLPUBFUN xmlSchematronParserCtxtPtr73 xmlSchematronNewParserCtxt (const char *URL);74XMLPUBFUN xmlSchematronParserCtxtPtr75 xmlSchematronNewMemParserCtxt(const char *buffer,76 int size);77XMLPUBFUN xmlSchematronParserCtxtPtr78 xmlSchematronNewDocParserCtxt(xmlDocPtr doc);79XMLPUBFUN void80 xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);81/*****82XMLPUBFUN void83 xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,84 xmlSchematronValidityErrorFunc err,85 xmlSchematronValidityWarningFunc warn,86 void *ctx);87XMLPUBFUN int88 xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,89 xmlSchematronValidityErrorFunc * err,90 xmlSchematronValidityWarningFunc * warn,91 void **ctx);92XMLPUBFUN int93 xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);94 *****/95XMLPUBFUN xmlSchematronPtr96 xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);97XMLPUBFUN void98 xmlSchematronFree (xmlSchematronPtr schema);99/*100 * Interfaces for validating101 */102XMLPUBFUN void103 xmlSchematronSetValidStructuredErrors(104 xmlSchematronValidCtxtPtr ctxt,105 xmlStructuredErrorFunc serror,106 void *ctx);107/******108XMLPUBFUN void109 xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,110 xmlSchematronValidityErrorFunc err,111 xmlSchematronValidityWarningFunc warn,112 void *ctx);113XMLPUBFUN int114 xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,115 xmlSchematronValidityErrorFunc *err,116 xmlSchematronValidityWarningFunc *warn,117 void **ctx);118XMLPUBFUN int119 xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,120 int options);121XMLPUBFUN int122 xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);123XMLPUBFUN int124 xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,125 xmlNodePtr elem);126 *******/127 128XMLPUBFUN xmlSchematronValidCtxtPtr129 xmlSchematronNewValidCtxt (xmlSchematronPtr schema,130 int options);131XMLPUBFUN void132 xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);133XMLPUBFUN int134 xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,135 xmlDocPtr instance);136 137#ifdef __cplusplus138}139#endif140 141#endif /* LIBXML_SCHEMATRON_ENABLED */142#endif /* __XML_SCHEMATRON_H__ */143 