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