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