schematron.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. #ifndef __XML_SCHEMATRON_H__
  10. #define __XML_SCHEMATRON_H__
  11. #include <libxml/xmlversion.h>
  12. #ifdef LIBXML_SCHEMATRON_ENABLED
  13. #include <libxml/tree.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. typedef enum {
  18. XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */
  19. XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */
  20. XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */
  21. XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */
  22. XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */
  23. XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
  24. XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
  25. }
  26. xmlSchematronValidOptions;
  27. /**
  28. * The schemas related types are kept internal
  29. */
  30. typedef struct _xmlSchematron xmlSchematron;
  31. typedef xmlSchematron *xmlSchematronPtr;
  32. /**
  33. * xmlSchematronValidityErrorFunc:
  34. * @ctx: the validation context
  35. * @msg: the message
  36. * @...: extra arguments
  37. *
  38. * Signature of an error callback from a Schematron validation
  39. */
  40. typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
  41. /**
  42. * xmlSchematronValidityWarningFunc:
  43. * @ctx: the validation context
  44. * @msg: the message
  45. * @...: extra arguments
  46. *
  47. * Signature of a warning callback from a Schematron validation
  48. */
  49. typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
  50. /**
  51. * A schemas validation context
  52. */
  53. typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
  54. typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
  55. typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
  56. typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
  57. /*
  58. * Interfaces for parsing.
  59. */
  60. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  61. xmlSchematronNewParserCtxt (const char *URL);
  62. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  63. xmlSchematronNewMemParserCtxt(const char *buffer,
  64. int size);
  65. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  66. xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
  67. XMLPUBFUN void XMLCALL
  68. xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
  69. /*****
  70. XMLPUBFUN void XMLCALL
  71. xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
  72. xmlSchematronValidityErrorFunc err,
  73. xmlSchematronValidityWarningFunc warn,
  74. void *ctx);
  75. XMLPUBFUN int XMLCALL
  76. xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
  77. xmlSchematronValidityErrorFunc * err,
  78. xmlSchematronValidityWarningFunc * warn,
  79. void **ctx);
  80. XMLPUBFUN int XMLCALL
  81. xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
  82. *****/
  83. XMLPUBFUN xmlSchematronPtr XMLCALL
  84. xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
  85. XMLPUBFUN void XMLCALL
  86. xmlSchematronFree (xmlSchematronPtr schema);
  87. /*
  88. * Interfaces for validating
  89. */
  90. XMLPUBFUN void XMLCALL
  91. xmlSchematronSetValidStructuredErrors(
  92. xmlSchematronValidCtxtPtr ctxt,
  93. xmlStructuredErrorFunc serror,
  94. void *ctx);
  95. /******
  96. XMLPUBFUN void XMLCALL
  97. xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
  98. xmlSchematronValidityErrorFunc err,
  99. xmlSchematronValidityWarningFunc warn,
  100. void *ctx);
  101. XMLPUBFUN int XMLCALL
  102. xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
  103. xmlSchematronValidityErrorFunc *err,
  104. xmlSchematronValidityWarningFunc *warn,
  105. void **ctx);
  106. XMLPUBFUN int XMLCALL
  107. xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
  108. int options);
  109. XMLPUBFUN int XMLCALL
  110. xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
  111. XMLPUBFUN int XMLCALL
  112. xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
  113. xmlNodePtr elem);
  114. *******/
  115. XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
  116. xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
  117. int options);
  118. XMLPUBFUN void XMLCALL
  119. xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
  120. XMLPUBFUN int XMLCALL
  121. xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
  122. xmlDocPtr instance);
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126. #endif /* LIBXML_SCHEMATRON_ENABLED */
  127. #endif /* __XML_SCHEMATRON_H__ */