schematron.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. } xmlSchematronValidOptions;
  26. /**
  27. * The schemas related types are kept internal
  28. */
  29. typedef struct _xmlSchematron xmlSchematron;
  30. typedef xmlSchematron *xmlSchematronPtr;
  31. /**
  32. * xmlSchematronValidityErrorFunc:
  33. * @ctx: the validation context
  34. * @msg: the message
  35. * @...: extra arguments
  36. *
  37. * Signature of an error callback from a Schematron validation
  38. */
  39. typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
  40. /**
  41. * xmlSchematronValidityWarningFunc:
  42. * @ctx: the validation context
  43. * @msg: the message
  44. * @...: extra arguments
  45. *
  46. * Signature of a warning callback from a Schematron validation
  47. */
  48. typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
  49. /**
  50. * A schemas validation context
  51. */
  52. typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
  53. typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
  54. typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
  55. typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
  56. /*
  57. * Interfaces for parsing.
  58. */
  59. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  60. xmlSchematronNewParserCtxt (const char *URL);
  61. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  62. xmlSchematronNewMemParserCtxt(const char *buffer,
  63. int size);
  64. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  65. xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
  66. XMLPUBFUN void XMLCALL
  67. xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
  68. /*****
  69. XMLPUBFUN void XMLCALL
  70. xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
  71. xmlSchematronValidityErrorFunc err,
  72. xmlSchematronValidityWarningFunc warn,
  73. void *ctx);
  74. XMLPUBFUN int XMLCALL
  75. xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
  76. xmlSchematronValidityErrorFunc * err,
  77. xmlSchematronValidityWarningFunc * warn,
  78. void **ctx);
  79. XMLPUBFUN int XMLCALL
  80. xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
  81. *****/
  82. XMLPUBFUN xmlSchematronPtr XMLCALL
  83. xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
  84. XMLPUBFUN void XMLCALL
  85. xmlSchematronFree (xmlSchematronPtr schema);
  86. /*
  87. * Interfaces for validating
  88. */
  89. XMLPUBFUN void XMLCALL
  90. xmlSchematronSetValidStructuredErrors(
  91. xmlSchematronValidCtxtPtr ctxt,
  92. xmlStructuredErrorFunc serror,
  93. void *ctx);
  94. /******
  95. XMLPUBFUN void XMLCALL
  96. xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
  97. xmlSchematronValidityErrorFunc err,
  98. xmlSchematronValidityWarningFunc warn,
  99. void *ctx);
  100. XMLPUBFUN int XMLCALL
  101. xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
  102. xmlSchematronValidityErrorFunc *err,
  103. xmlSchematronValidityWarningFunc *warn,
  104. void **ctx);
  105. XMLPUBFUN int XMLCALL
  106. xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
  107. int options);
  108. XMLPUBFUN int XMLCALL
  109. xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
  110. XMLPUBFUN int XMLCALL
  111. xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
  112. xmlNodePtr elem);
  113. *******/
  114. XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
  115. xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
  116. int options);
  117. XMLPUBFUN void XMLCALL
  118. xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
  119. XMLPUBFUN int XMLCALL
  120. xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
  121. xmlDocPtr instance);
  122. #ifdef __cplusplus
  123. }
  124. #endif
  125. #endif /* LIBXML_SCHEMATRON_ENABLED */
  126. #endif /* __XML_SCHEMATRON_H__ */