catalog.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /**
  2. * Summary: interfaces to the Catalog handling system
  3. * Description: the catalog module implements the support for
  4. * XML Catalogs and SGML catalogs
  5. *
  6. * SGML Open Technical Resolution TR9401:1997.
  7. * http://www.jclark.com/sp/catalog.htm
  8. *
  9. * XML Catalogs Working Draft 06 August 2001
  10. * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
  11. *
  12. * Copy: See Copyright for the status of this software.
  13. *
  14. * Author: Daniel Veillard
  15. */
  16. #ifndef __XML_CATALOG_H__
  17. #define __XML_CATALOG_H__
  18. #include <stdio.h>
  19. #include <libxml/xmlversion.h>
  20. #include <libxml/xmlstring.h>
  21. #include <libxml/tree.h>
  22. #ifdef LIBXML_CATALOG_ENABLED
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /**
  27. * XML_CATALOGS_NAMESPACE:
  28. *
  29. * The namespace for the XML Catalogs elements.
  30. */
  31. #define XML_CATALOGS_NAMESPACE \
  32. (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
  33. /**
  34. * XML_CATALOG_PI:
  35. *
  36. * The specific XML Catalog Processing Instuction name.
  37. */
  38. #define XML_CATALOG_PI \
  39. (const xmlChar *) "oasis-xml-catalog"
  40. /*
  41. * The API is voluntarily limited to general cataloging.
  42. */
  43. typedef enum {
  44. XML_CATA_PREFER_NONE = 0,
  45. XML_CATA_PREFER_PUBLIC = 1,
  46. XML_CATA_PREFER_SYSTEM
  47. }
  48. xmlCatalogPrefer;
  49. typedef enum {
  50. XML_CATA_ALLOW_NONE = 0,
  51. XML_CATA_ALLOW_GLOBAL = 1,
  52. XML_CATA_ALLOW_DOCUMENT = 2,
  53. XML_CATA_ALLOW_ALL = 3
  54. } xmlCatalogAllow;
  55. typedef struct _xmlCatalog xmlCatalog;
  56. typedef xmlCatalog *xmlCatalogPtr;
  57. /*
  58. * Operations on a given catalog.
  59. */
  60. XMLPUBFUN xmlCatalogPtr XMLCALL
  61. xmlNewCatalog (int sgml);
  62. XMLPUBFUN xmlCatalogPtr XMLCALL
  63. xmlLoadACatalog (const char *filename);
  64. XMLPUBFUN xmlCatalogPtr XMLCALL
  65. xmlLoadSGMLSuperCatalog (const char *filename);
  66. XMLPUBFUN int XMLCALL
  67. xmlConvertSGMLCatalog (xmlCatalogPtr catal);
  68. XMLPUBFUN int XMLCALL
  69. xmlACatalogAdd (xmlCatalogPtr catal,
  70. const xmlChar *type,
  71. const xmlChar *orig,
  72. const xmlChar *replace);
  73. XMLPUBFUN int XMLCALL
  74. xmlACatalogRemove (xmlCatalogPtr catal,
  75. const xmlChar *value);
  76. XMLPUBFUN xmlChar * XMLCALL
  77. xmlACatalogResolve (xmlCatalogPtr catal,
  78. const xmlChar *pubID,
  79. const xmlChar *sysID);
  80. XMLPUBFUN xmlChar * XMLCALL
  81. xmlACatalogResolveSystem(xmlCatalogPtr catal,
  82. const xmlChar *sysID);
  83. XMLPUBFUN xmlChar * XMLCALL
  84. xmlACatalogResolvePublic(xmlCatalogPtr catal,
  85. const xmlChar *pubID);
  86. XMLPUBFUN xmlChar * XMLCALL
  87. xmlACatalogResolveURI (xmlCatalogPtr catal,
  88. const xmlChar *URI);
  89. #ifdef LIBXML_OUTPUT_ENABLED
  90. XMLPUBFUN void XMLCALL
  91. xmlACatalogDump (xmlCatalogPtr catal,
  92. FILE *out);
  93. #endif /* LIBXML_OUTPUT_ENABLED */
  94. XMLPUBFUN void XMLCALL
  95. xmlFreeCatalog (xmlCatalogPtr catal);
  96. XMLPUBFUN int XMLCALL
  97. xmlCatalogIsEmpty (xmlCatalogPtr catal);
  98. /*
  99. * Global operations.
  100. */
  101. XMLPUBFUN void XMLCALL
  102. xmlInitializeCatalog (void);
  103. XMLPUBFUN int XMLCALL
  104. xmlLoadCatalog (const char *filename);
  105. XMLPUBFUN void XMLCALL
  106. xmlLoadCatalogs (const char *paths);
  107. XMLPUBFUN void XMLCALL
  108. xmlCatalogCleanup (void);
  109. #ifdef LIBXML_OUTPUT_ENABLED
  110. XMLPUBFUN void XMLCALL
  111. xmlCatalogDump (FILE *out);
  112. #endif /* LIBXML_OUTPUT_ENABLED */
  113. XMLPUBFUN xmlChar * XMLCALL
  114. xmlCatalogResolve (const xmlChar *pubID,
  115. const xmlChar *sysID);
  116. XMLPUBFUN xmlChar * XMLCALL
  117. xmlCatalogResolveSystem (const xmlChar *sysID);
  118. XMLPUBFUN xmlChar * XMLCALL
  119. xmlCatalogResolvePublic (const xmlChar *pubID);
  120. XMLPUBFUN xmlChar * XMLCALL
  121. xmlCatalogResolveURI (const xmlChar *URI);
  122. XMLPUBFUN int XMLCALL
  123. xmlCatalogAdd (const xmlChar *type,
  124. const xmlChar *orig,
  125. const xmlChar *replace);
  126. XMLPUBFUN int XMLCALL
  127. xmlCatalogRemove (const xmlChar *value);
  128. XMLPUBFUN xmlDocPtr XMLCALL
  129. xmlParseCatalogFile (const char *filename);
  130. XMLPUBFUN int XMLCALL
  131. xmlCatalogConvert (void);
  132. /*
  133. * Strictly minimal interfaces for per-document catalogs used
  134. * by the parser.
  135. */
  136. XMLPUBFUN void XMLCALL
  137. xmlCatalogFreeLocal (void *catalogs);
  138. XMLPUBFUN void * XMLCALL
  139. xmlCatalogAddLocal (void *catalogs,
  140. const xmlChar *URL);
  141. XMLPUBFUN xmlChar * XMLCALL
  142. xmlCatalogLocalResolve (void *catalogs,
  143. const xmlChar *pubID,
  144. const xmlChar *sysID);
  145. XMLPUBFUN xmlChar * XMLCALL
  146. xmlCatalogLocalResolveURI(void *catalogs,
  147. const xmlChar *URI);
  148. /*
  149. * Preference settings.
  150. */
  151. XMLPUBFUN int XMLCALL
  152. xmlCatalogSetDebug (int level);
  153. XMLPUBFUN xmlCatalogPrefer XMLCALL
  154. xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
  155. XMLPUBFUN void XMLCALL
  156. xmlCatalogSetDefaults (xmlCatalogAllow allow);
  157. XMLPUBFUN xmlCatalogAllow XMLCALL
  158. xmlCatalogGetDefaults (void);
  159. /* DEPRECATED interfaces */
  160. XMLPUBFUN const xmlChar * XMLCALL
  161. xmlCatalogGetSystem (const xmlChar *sysID);
  162. XMLPUBFUN const xmlChar * XMLCALL
  163. xmlCatalogGetPublic (const xmlChar *pubID);
  164. #ifdef __cplusplus
  165. }
  166. #endif
  167. #endif /* LIBXML_CATALOG_ENABLED */
  168. #endif /* __XML_CATALOG_H__ */