1 /* libxml2 - Library for parsing XML documents 2 * Copyright (C) 2006-2019 Free Software Foundation, Inc. 3 * 4 * This file is not part of the GNU gettext program, but is used with 5 * GNU gettext. 6 * 7 * The original copyright notice is as follows: 8 */ 9 10 /* 11 * Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved. 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining a copy 14 * of this software and associated documentation files (the "Software"), to deal 15 * in the Software without restriction, including without limitation the rights 16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 * copies of the Software, and to permit persons to whom the Software is fur- 18 * nished to do so, subject to the following conditions: 19 * 20 * The above copyright notice and this permission notice shall be included in 21 * all copies or substantial portions of the Software. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- 25 * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 * THE SOFTWARE. 30 * 31 * Author: Daniel Veillard 32 */ 33 34 /** 35 * Summary: interfaces to the Catalog handling system 36 * Description: the catalog module implements the support for 37 * XML Catalogs and SGML catalogs 38 * 39 * SGML Open Technical Resolution TR9401:1997. 40 * http://www.jclark.com/sp/catalog.htm 41 * 42 * XML Catalogs Working Draft 06 August 2001 43 * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html 44 */ 45 46 #ifndef __XML_CATALOG_H__ 47 #define __XML_CATALOG_H__ 48 49 #include <stdio.h> 50 51 #include <libxml/xmlversion.h> 52 #include <libxml/xmlstring.h> 53 #include <libxml/tree.h> 54 55 #ifdef LIBXML_CATALOG_ENABLED 56 57 #ifdef __cplusplus 58 extern "C" { 59 #endif 60 61 /** 62 * XML_CATALOGS_NAMESPACE: 63 * 64 * The namespace for the XML Catalogs elements. 65 */ 66 #define XML_CATALOGS_NAMESPACE \ 67 (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" 68 /** 69 * XML_CATALOG_PI: 70 * 71 * The specific XML Catalog Processing Instuction name. 72 */ 73 #define XML_CATALOG_PI \ 74 (const xmlChar *) "oasis-xml-catalog" 75 76 /* 77 * The API is voluntarily limited to general cataloging. 78 */ 79 typedef enum { 80 XML_CATA_PREFER_NONE = 0, 81 XML_CATA_PREFER_PUBLIC = 1, 82 XML_CATA_PREFER_SYSTEM 83 } xmlCatalogPrefer; 84 85 typedef enum { 86 XML_CATA_ALLOW_NONE = 0, 87 XML_CATA_ALLOW_GLOBAL = 1, 88 XML_CATA_ALLOW_DOCUMENT = 2, 89 XML_CATA_ALLOW_ALL = 3 90 } xmlCatalogAllow; 91 92 typedef struct _xmlCatalog xmlCatalog; 93 typedef xmlCatalog *xmlCatalogPtr; 94 95 /* 96 * Operations on a given catalog. 97 */ 98 XMLPUBFUN xmlCatalogPtr XMLCALL 99 xmlNewCatalog (int sgml); 100 XMLPUBFUN xmlCatalogPtr XMLCALL 101 xmlLoadACatalog (const char *filename); 102 XMLPUBFUN xmlCatalogPtr XMLCALL 103 xmlLoadSGMLSuperCatalog (const char *filename); 104 XMLPUBFUN int XMLCALL 105 xmlConvertSGMLCatalog (xmlCatalogPtr catal); 106 XMLPUBFUN int XMLCALL 107 xmlACatalogAdd (xmlCatalogPtr catal, 108 const xmlChar *type, 109 const xmlChar *orig, 110 const xmlChar *replace); 111 XMLPUBFUN int XMLCALL 112 xmlACatalogRemove (xmlCatalogPtr catal, 113 const xmlChar *value); 114 XMLPUBFUN xmlChar * XMLCALL 115 xmlACatalogResolve (xmlCatalogPtr catal, 116 const xmlChar *pubID, 117 const xmlChar *sysID); 118 XMLPUBFUN xmlChar * XMLCALL 119 xmlACatalogResolveSystem(xmlCatalogPtr catal, 120 const xmlChar *sysID); 121 XMLPUBFUN xmlChar * XMLCALL 122 xmlACatalogResolvePublic(xmlCatalogPtr catal, 123 const xmlChar *pubID); 124 XMLPUBFUN xmlChar * XMLCALL 125 xmlACatalogResolveURI (xmlCatalogPtr catal, 126 const xmlChar *URI); 127 #ifdef LIBXML_OUTPUT_ENABLED 128 XMLPUBFUN void XMLCALL 129 xmlACatalogDump (xmlCatalogPtr catal, 130 FILE *out); 131 #endif /* LIBXML_OUTPUT_ENABLED */ 132 XMLPUBFUN void XMLCALL 133 xmlFreeCatalog (xmlCatalogPtr catal); 134 XMLPUBFUN int XMLCALL 135 xmlCatalogIsEmpty (xmlCatalogPtr catal); 136 137 /* 138 * Global operations. 139 */ 140 XMLPUBFUN void XMLCALL 141 xmlInitializeCatalog (void); 142 XMLPUBFUN int XMLCALL 143 xmlLoadCatalog (const char *filename); 144 XMLPUBFUN void XMLCALL 145 xmlLoadCatalogs (const char *paths); 146 XMLPUBFUN void XMLCALL 147 xmlCatalogCleanup (void); 148 #ifdef LIBXML_OUTPUT_ENABLED 149 XMLPUBFUN void XMLCALL 150 xmlCatalogDump (FILE *out); 151 #endif /* LIBXML_OUTPUT_ENABLED */ 152 XMLPUBFUN xmlChar * XMLCALL 153 xmlCatalogResolve (const xmlChar *pubID, 154 const xmlChar *sysID); 155 XMLPUBFUN xmlChar * XMLCALL 156 xmlCatalogResolveSystem (const xmlChar *sysID); 157 XMLPUBFUN xmlChar * XMLCALL 158 xmlCatalogResolvePublic (const xmlChar *pubID); 159 XMLPUBFUN xmlChar * XMLCALL 160 xmlCatalogResolveURI (const xmlChar *URI); 161 XMLPUBFUN int XMLCALL 162 xmlCatalogAdd (const xmlChar *type, 163 const xmlChar *orig, 164 const xmlChar *replace); 165 XMLPUBFUN int XMLCALL 166 xmlCatalogRemove (const xmlChar *value); 167 XMLPUBFUN xmlDocPtr XMLCALL 168 xmlParseCatalogFile (const char *filename); 169 XMLPUBFUN int XMLCALL 170 xmlCatalogConvert (void); 171 172 /* 173 * Strictly minimal interfaces for per-document catalogs used 174 * by the parser. 175 */ 176 XMLPUBFUN void XMLCALL 177 xmlCatalogFreeLocal (void *catalogs); 178 XMLPUBFUN void * XMLCALL 179 xmlCatalogAddLocal (void *catalogs, 180 const xmlChar *URL); 181 XMLPUBFUN xmlChar * XMLCALL 182 xmlCatalogLocalResolve (void *catalogs, 183 const xmlChar *pubID, 184 const xmlChar *sysID); 185 XMLPUBFUN xmlChar * XMLCALL 186 xmlCatalogLocalResolveURI(void *catalogs, 187 const xmlChar *URI); 188 /* 189 * Preference settings. 190 */ 191 XMLPUBFUN int XMLCALL 192 xmlCatalogSetDebug (int level); 193 XMLPUBFUN xmlCatalogPrefer XMLCALL 194 xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); 195 XMLPUBFUN void XMLCALL 196 xmlCatalogSetDefaults (xmlCatalogAllow allow); 197 XMLPUBFUN xmlCatalogAllow XMLCALL 198 xmlCatalogGetDefaults (void); 199 200 201 /* DEPRECATED interfaces */ 202 XMLPUBFUN const xmlChar * XMLCALL 203 xmlCatalogGetSystem (const xmlChar *sysID); 204 XMLPUBFUN const xmlChar * XMLCALL 205 xmlCatalogGetPublic (const xmlChar *pubID); 206 207 #ifdef __cplusplus 208 } 209 #endif 210 #endif /* LIBXML_CATALOG_ENABLED */ 211 #endif /* __XML_CATALOG_H__ */ 212