schematron.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. * A schemas validation context
  33. */
  34. typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
  35. typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
  36. typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
  37. typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
  38. typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
  39. typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
  40. /*
  41. * Interfaces for parsing.
  42. */
  43. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  44. xmlSchematronNewParserCtxt (const char *URL);
  45. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  46. xmlSchematronNewMemParserCtxt(const char *buffer,
  47. int size);
  48. XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
  49. xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
  50. XMLPUBFUN void XMLCALL
  51. xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
  52. /*****
  53. XMLPUBFUN void XMLCALL
  54. xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
  55. xmlSchematronValidityErrorFunc err,
  56. xmlSchematronValidityWarningFunc warn,
  57. void *ctx);
  58. XMLPUBFUN int XMLCALL
  59. xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
  60. xmlSchematronValidityErrorFunc * err,
  61. xmlSchematronValidityWarningFunc * warn,
  62. void **ctx);
  63. XMLPUBFUN int XMLCALL
  64. xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
  65. *****/
  66. XMLPUBFUN xmlSchematronPtr XMLCALL
  67. xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
  68. XMLPUBFUN void XMLCALL
  69. xmlSchematronFree (xmlSchematronPtr schema);
  70. /*
  71. * Interfaces for validating
  72. */
  73. XMLPUBFUN void XMLCALL
  74. xmlSchematronSetValidStructuredErrors(
  75. xmlSchematronValidCtxtPtr ctxt,
  76. xmlStructuredErrorFunc serror,
  77. void *ctx);
  78. /******
  79. XMLPUBFUN void XMLCALL
  80. xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
  81. xmlSchematronValidityErrorFunc err,
  82. xmlSchematronValidityWarningFunc warn,
  83. void *ctx);
  84. XMLPUBFUN int XMLCALL
  85. xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
  86. xmlSchematronValidityErrorFunc *err,
  87. xmlSchematronValidityWarningFunc *warn,
  88. void **ctx);
  89. XMLPUBFUN int XMLCALL
  90. xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
  91. int options);
  92. XMLPUBFUN int XMLCALL
  93. xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
  94. XMLPUBFUN int XMLCALL
  95. xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
  96. xmlNodePtr elem);
  97. *******/
  98. XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
  99. xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
  100. int options);
  101. XMLPUBFUN void XMLCALL
  102. xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
  103. XMLPUBFUN int XMLCALL
  104. xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
  105. xmlDocPtr instance);
  106. #ifdef __cplusplus
  107. }
  108. #endif
  109. #endif /* LIBXML_SCHEMATRON_ENABLED */
  110. #endif /* __XML_SCHEMATRON_H__ */