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