catalog.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. } xmlCatalogPrefer;
  48. typedef enum {
  49. XML_CATA_ALLOW_NONE = 0,
  50. XML_CATA_ALLOW_GLOBAL = 1,
  51. XML_CATA_ALLOW_DOCUMENT = 2,
  52. XML_CATA_ALLOW_ALL = 3
  53. } xmlCatalogAllow;
  54. typedef struct _xmlCatalog xmlCatalog;
  55. typedef xmlCatalog *xmlCatalogPtr;
  56. /*
  57. * Operations on a given catalog.
  58. */
  59. XMLPUBFUN xmlCatalogPtr XMLCALL
  60. xmlNewCatalog (int sgml);
  61. XMLPUBFUN xmlCatalogPtr XMLCALL
  62. xmlLoadACatalog (const char *filename);
  63. XMLPUBFUN xmlCatalogPtr XMLCALL
  64. xmlLoadSGMLSuperCatalog (const char *filename);
  65. XMLPUBFUN int XMLCALL
  66. xmlConvertSGMLCatalog (xmlCatalogPtr catal);
  67. XMLPUBFUN int XMLCALL
  68. xmlACatalogAdd (xmlCatalogPtr catal,
  69. const xmlChar *type,
  70. const xmlChar *orig,
  71. const xmlChar *replace);
  72. XMLPUBFUN int XMLCALL
  73. xmlACatalogRemove (xmlCatalogPtr catal,
  74. const xmlChar *value);
  75. XMLPUBFUN xmlChar * XMLCALL
  76. xmlACatalogResolve (xmlCatalogPtr catal,
  77. const xmlChar *pubID,
  78. const xmlChar *sysID);
  79. XMLPUBFUN xmlChar * XMLCALL
  80. xmlACatalogResolveSystem(xmlCatalogPtr catal,
  81. const xmlChar *sysID);
  82. XMLPUBFUN xmlChar * XMLCALL
  83. xmlACatalogResolvePublic(xmlCatalogPtr catal,
  84. const xmlChar *pubID);
  85. XMLPUBFUN xmlChar * XMLCALL
  86. xmlACatalogResolveURI (xmlCatalogPtr catal,
  87. const xmlChar *URI);
  88. #ifdef LIBXML_OUTPUT_ENABLED
  89. XMLPUBFUN void XMLCALL
  90. xmlACatalogDump (xmlCatalogPtr catal,
  91. FILE *out);
  92. #endif /* LIBXML_OUTPUT_ENABLED */
  93. XMLPUBFUN void XMLCALL
  94. xmlFreeCatalog (xmlCatalogPtr catal);
  95. XMLPUBFUN int XMLCALL
  96. xmlCatalogIsEmpty (xmlCatalogPtr catal);
  97. /*
  98. * Global operations.
  99. */
  100. XMLPUBFUN void XMLCALL
  101. xmlInitializeCatalog (void);
  102. XMLPUBFUN int XMLCALL
  103. xmlLoadCatalog (const char *filename);
  104. XMLPUBFUN void XMLCALL
  105. xmlLoadCatalogs (const char *paths);
  106. XMLPUBFUN void XMLCALL
  107. xmlCatalogCleanup (void);
  108. #ifdef LIBXML_OUTPUT_ENABLED
  109. XMLPUBFUN void XMLCALL
  110. xmlCatalogDump (FILE *out);
  111. #endif /* LIBXML_OUTPUT_ENABLED */
  112. XMLPUBFUN xmlChar * XMLCALL
  113. xmlCatalogResolve (const xmlChar *pubID,
  114. const xmlChar *sysID);
  115. XMLPUBFUN xmlChar * XMLCALL
  116. xmlCatalogResolveSystem (const xmlChar *sysID);
  117. XMLPUBFUN xmlChar * XMLCALL
  118. xmlCatalogResolvePublic (const xmlChar *pubID);
  119. XMLPUBFUN xmlChar * XMLCALL
  120. xmlCatalogResolveURI (const xmlChar *URI);
  121. XMLPUBFUN int XMLCALL
  122. xmlCatalogAdd (const xmlChar *type,
  123. const xmlChar *orig,
  124. const xmlChar *replace);
  125. XMLPUBFUN int XMLCALL
  126. xmlCatalogRemove (const xmlChar *value);
  127. XMLPUBFUN xmlDocPtr XMLCALL
  128. xmlParseCatalogFile (const char *filename);
  129. XMLPUBFUN int XMLCALL
  130. xmlCatalogConvert (void);
  131. /*
  132. * Strictly minimal interfaces for per-document catalogs used
  133. * by the parser.
  134. */
  135. XMLPUBFUN void XMLCALL
  136. xmlCatalogFreeLocal (void *catalogs);
  137. XMLPUBFUN void * XMLCALL
  138. xmlCatalogAddLocal (void *catalogs,
  139. const xmlChar *URL);
  140. XMLPUBFUN xmlChar * XMLCALL
  141. xmlCatalogLocalResolve (void *catalogs,
  142. const xmlChar *pubID,
  143. const xmlChar *sysID);
  144. XMLPUBFUN xmlChar * XMLCALL
  145. xmlCatalogLocalResolveURI(void *catalogs,
  146. const xmlChar *URI);
  147. /*
  148. * Preference settings.
  149. */
  150. XMLPUBFUN int XMLCALL
  151. xmlCatalogSetDebug (int level);
  152. XMLPUBFUN xmlCatalogPrefer XMLCALL
  153. xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
  154. XMLPUBFUN void XMLCALL
  155. xmlCatalogSetDefaults (xmlCatalogAllow allow);
  156. XMLPUBFUN xmlCatalogAllow XMLCALL
  157. xmlCatalogGetDefaults (void);
  158. /* DEPRECATED interfaces */
  159. XMLPUBFUN const xmlChar * XMLCALL
  160. xmlCatalogGetSystem (const xmlChar *sysID);
  161. XMLPUBFUN const xmlChar * XMLCALL
  162. xmlCatalogGetPublic (const xmlChar *pubID);
  163. #ifdef __cplusplus
  164. }
  165. #endif
  166. #endif /* LIBXML_CATALOG_ENABLED */
  167. #endif /* __XML_CATALOG_H__ */