Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:41:50

0001 /*
0002  * Summary: XML Schematron implementation
0003  * Description: interface to the XML Schematron validity checking.
0004  *
0005  * Copy: See Copyright for the status of this software.
0006  *
0007  * Author: Daniel Veillard
0008  */
0009 
0010 
0011 #ifndef __XML_SCHEMATRON_H__
0012 #define __XML_SCHEMATRON_H__
0013 
0014 #include <libxml/xmlversion.h>
0015 
0016 #ifdef LIBXML_SCHEMATRON_ENABLED
0017 
0018 #include <libxml/xmlerror.h>
0019 #include <libxml/tree.h>
0020 
0021 #ifdef __cplusplus
0022 extern "C" {
0023 #endif
0024 
0025 typedef enum {
0026     XML_SCHEMATRON_OUT_QUIET = 1 << 0,  /* quiet no report */
0027     XML_SCHEMATRON_OUT_TEXT = 1 << 1,   /* build a textual report */
0028     XML_SCHEMATRON_OUT_XML = 1 << 2,    /* output SVRL */
0029     XML_SCHEMATRON_OUT_ERROR = 1 << 3,  /* output via xmlStructuredErrorFunc */
0030     XML_SCHEMATRON_OUT_FILE = 1 << 8,   /* output to a file descriptor */
0031     XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
0032     XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
0033 } xmlSchematronValidOptions;
0034 
0035 /**
0036  * The schemas related types are kept internal
0037  */
0038 typedef struct _xmlSchematron xmlSchematron;
0039 typedef xmlSchematron *xmlSchematronPtr;
0040 
0041 /**
0042  * xmlSchematronValidityErrorFunc:
0043  * @ctx: the validation context
0044  * @msg: the message
0045  * @...: extra arguments
0046  *
0047  * Signature of an error callback from a Schematron validation
0048  */
0049 typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
0050 
0051 /**
0052  * xmlSchematronValidityWarningFunc:
0053  * @ctx: the validation context
0054  * @msg: the message
0055  * @...: extra arguments
0056  *
0057  * Signature of a warning callback from a Schematron validation
0058  */
0059 typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
0060 
0061 /**
0062  * A schemas validation context
0063  */
0064 typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
0065 typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
0066 
0067 typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
0068 typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
0069 
0070 /*
0071  * Interfaces for parsing.
0072  */
0073 XMLPUBFUN xmlSchematronParserCtxtPtr
0074         xmlSchematronNewParserCtxt  (const char *URL);
0075 XMLPUBFUN xmlSchematronParserCtxtPtr
0076         xmlSchematronNewMemParserCtxt(const char *buffer,
0077                      int size);
0078 XMLPUBFUN xmlSchematronParserCtxtPtr
0079         xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
0080 XMLPUBFUN void
0081         xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
0082 /*****
0083 XMLPUBFUN void
0084         xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
0085                      xmlSchematronValidityErrorFunc err,
0086                      xmlSchematronValidityWarningFunc warn,
0087                      void *ctx);
0088 XMLPUBFUN int
0089         xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
0090                     xmlSchematronValidityErrorFunc * err,
0091                     xmlSchematronValidityWarningFunc * warn,
0092                     void **ctx);
0093 XMLPUBFUN int
0094         xmlSchematronIsValid    (xmlSchematronValidCtxtPtr ctxt);
0095  *****/
0096 XMLPUBFUN xmlSchematronPtr
0097         xmlSchematronParse      (xmlSchematronParserCtxtPtr ctxt);
0098 XMLPUBFUN void
0099         xmlSchematronFree       (xmlSchematronPtr schema);
0100 /*
0101  * Interfaces for validating
0102  */
0103 XMLPUBFUN void
0104         xmlSchematronSetValidStructuredErrors(
0105                                       xmlSchematronValidCtxtPtr ctxt,
0106                       xmlStructuredErrorFunc serror,
0107                       void *ctx);
0108 /******
0109 XMLPUBFUN void
0110         xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
0111                      xmlSchematronValidityErrorFunc err,
0112                      xmlSchematronValidityWarningFunc warn,
0113                      void *ctx);
0114 XMLPUBFUN int
0115         xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
0116                      xmlSchematronValidityErrorFunc *err,
0117                      xmlSchematronValidityWarningFunc *warn,
0118                      void **ctx);
0119 XMLPUBFUN int
0120         xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
0121                      int options);
0122 XMLPUBFUN int
0123         xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
0124 XMLPUBFUN int
0125             xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
0126                              xmlNodePtr elem);
0127  *******/
0128 
0129 XMLPUBFUN xmlSchematronValidCtxtPtr
0130         xmlSchematronNewValidCtxt   (xmlSchematronPtr schema,
0131                      int options);
0132 XMLPUBFUN void
0133         xmlSchematronFreeValidCtxt  (xmlSchematronValidCtxtPtr ctxt);
0134 XMLPUBFUN int
0135         xmlSchematronValidateDoc    (xmlSchematronValidCtxtPtr ctxt,
0136                      xmlDocPtr instance);
0137 
0138 #ifdef __cplusplus
0139 }
0140 #endif
0141 
0142 #endif /* LIBXML_SCHEMATRON_ENABLED */
0143 #endif /* __XML_SCHEMATRON_H__ */