/ libxml2 / include / libxml / schematron.h
schematron.h
  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
 21  extern "C" {
 22  #endif
 23  
 24  typedef 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 internal
 36   */
 37  typedef struct _xmlSchematron xmlSchematron;
 38  typedef xmlSchematron *xmlSchematronPtr;
 39  
 40  /**
 41   * xmlSchematronValidityErrorFunc:
 42   * @ctx: the validation context
 43   * @msg: the message
 44   * @...: extra arguments
 45   *
 46   * Signature of an error callback from a Schematron validation
 47   */
 48  typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
 49  
 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   */
 58  typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
 59  
 60  /**
 61   * A schemas validation context
 62   */
 63  typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
 64  typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
 65  
 66  typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
 67  typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
 68  
 69  /*
 70   * Interfaces for parsing.
 71   */
 72  XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
 73  	    xmlSchematronNewParserCtxt	(const char *URL);
 74  XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
 75  	    xmlSchematronNewMemParserCtxt(const char *buffer,
 76  					 int size);
 77  XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
 78  	    xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
 79  XMLPUBFUN void XMLCALL
 80  	    xmlSchematronFreeParserCtxt	(xmlSchematronParserCtxtPtr ctxt);
 81  /*****
 82  XMLPUBFUN void XMLCALL
 83  	    xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
 84  					 xmlSchematronValidityErrorFunc err,
 85  					 xmlSchematronValidityWarningFunc warn,
 86  					 void *ctx);
 87  XMLPUBFUN int XMLCALL
 88  		xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
 89  					xmlSchematronValidityErrorFunc * err,
 90  					xmlSchematronValidityWarningFunc * warn,
 91  					void **ctx);
 92  XMLPUBFUN int XMLCALL
 93  		xmlSchematronIsValid	(xmlSchematronValidCtxtPtr ctxt);
 94   *****/
 95  XMLPUBFUN xmlSchematronPtr XMLCALL
 96  	    xmlSchematronParse		(xmlSchematronParserCtxtPtr ctxt);
 97  XMLPUBFUN void XMLCALL
 98  	    xmlSchematronFree		(xmlSchematronPtr schema);
 99  /*
100   * Interfaces for validating
101   */
102  XMLPUBFUN void XMLCALL
103  	    xmlSchematronSetValidStructuredErrors(
104  	                                  xmlSchematronValidCtxtPtr ctxt,
105  					  xmlStructuredErrorFunc serror,
106  					  void *ctx);
107  /******
108  XMLPUBFUN void XMLCALL
109  	    xmlSchematronSetValidErrors	(xmlSchematronValidCtxtPtr ctxt,
110  					 xmlSchematronValidityErrorFunc err,
111  					 xmlSchematronValidityWarningFunc warn,
112  					 void *ctx);
113  XMLPUBFUN int XMLCALL
114  	    xmlSchematronGetValidErrors	(xmlSchematronValidCtxtPtr ctxt,
115  					 xmlSchematronValidityErrorFunc *err,
116  					 xmlSchematronValidityWarningFunc *warn,
117  					 void **ctx);
118  XMLPUBFUN int XMLCALL
119  	    xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
120  					 int options);
121  XMLPUBFUN int XMLCALL
122  	    xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
123  XMLPUBFUN int XMLCALL
124              xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
125  			                 xmlNodePtr elem);
126   *******/
127  
128  XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
129  	    xmlSchematronNewValidCtxt	(xmlSchematronPtr schema,
130  					 int options);
131  XMLPUBFUN void XMLCALL
132  	    xmlSchematronFreeValidCtxt	(xmlSchematronValidCtxtPtr ctxt);
133  XMLPUBFUN int XMLCALL
134  	    xmlSchematronValidateDoc	(xmlSchematronValidCtxtPtr ctxt,
135  					 xmlDocPtr instance);
136  
137  #ifdef __cplusplus
138  }
139  #endif
140  
141  #endif /* LIBXML_SCHEMATRON_ENABLED */
142  #endif /* __XML_SCHEMATRON_H__ */