blob: b4441370fcf79524eccc83881c282500bce982f3 [file] [log] [blame]
Daniel Veillarda7374592001-05-10 14:17:55 +00001/**
Daniel Veillardbe586972003-11-18 20:56:51 +00002 * Summary: interfaces to the Catalog handling system
3 * Description: the catalog module implements the support for
4 * XML Catalogs and SGML catalogs
Daniel Veillarda7374592001-05-10 14:17:55 +00005 *
Daniel Veillardbe586972003-11-18 20:56:51 +00006 * SGML Open Technical Resolution TR9401:1997.
7 * http://www.jclark.com/sp/catalog.htm
Daniel Veillarda7374592001-05-10 14:17:55 +00008 *
Daniel Veillardbe586972003-11-18 20:56:51 +00009 * XML Catalogs Working Draft 06 August 2001
10 * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
Daniel Veillard017b1082001-06-21 11:20:21 +000011 *
Daniel Veillardbe586972003-11-18 20:56:51 +000012 * Copy: See Copyright for the status of this software.
Daniel Veillarda7374592001-05-10 14:17:55 +000013 *
Daniel Veillardbe586972003-11-18 20:56:51 +000014 * Author: Daniel Veillard
Daniel Veillarda7374592001-05-10 14:17:55 +000015 */
16
17#ifndef __XML_CATALOG_H__
18#define __XML_CATALOG_H__
19
20#include <stdio.h>
21
22#include <libxml/xmlversion.h>
William M. Bracka2e844a2004-01-06 11:52:13 +000023#include <libxml/xmlstring.h>
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024#include <libxml/tree.h>
Igor Zlatkovic7ae91bc2002-11-08 17:18:52 +000025
Daniel Veillarda7374592001-05-10 14:17:55 +000026#ifdef LIBXML_CATALOG_ENABLED
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
Daniel Veillard017b1082001-06-21 11:20:21 +000032/**
33 * XML_CATALOGS_NAMESPACE:
34 *
Daniel Veillard61f26172002-03-12 18:46:39 +000035 * The namespace for the XML Catalogs elements.
Daniel Veillard017b1082001-06-21 11:20:21 +000036 */
Daniel Veillard5d90b6c2001-08-22 14:29:45 +000037#define XML_CATALOGS_NAMESPACE \
Daniel Veillard017b1082001-06-21 11:20:21 +000038 (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
Daniel Veillard9d06d302002-01-22 18:15:52 +000039/**
40 * XML_CATALOG_PI:
41 *
Daniel Veillard61f26172002-03-12 18:46:39 +000042 * The specific XML Catalog Processing Instuction name.
Daniel Veillard9d06d302002-01-22 18:15:52 +000043 */
Daniel Veillard5d90b6c2001-08-22 14:29:45 +000044#define XML_CATALOG_PI \
45 (const xmlChar *) "oasis-xml-catalog"
Daniel Veillard017b1082001-06-21 11:20:21 +000046
Daniel Veillarde2940dd2001-08-22 00:06:49 +000047/*
Daniel Veillard61f26172002-03-12 18:46:39 +000048 * The API is voluntarily limited to general cataloging.
Daniel Veillarde2940dd2001-08-22 00:06:49 +000049 */
50typedef enum {
51 XML_CATA_PREFER_NONE = 0,
52 XML_CATA_PREFER_PUBLIC = 1,
53 XML_CATA_PREFER_SYSTEM
54} xmlCatalogPrefer;
55
Daniel Veillard5d90b6c2001-08-22 14:29:45 +000056typedef 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
Daniel Veillard75b96822001-10-11 18:59:45 +000063typedef struct _xmlCatalog xmlCatalog;
64typedef xmlCatalog *xmlCatalogPtr;
65
66/*
Daniel Veillard61f26172002-03-12 18:46:39 +000067 * Operations on a given catalog.
Daniel Veillard75b96822001-10-11 18:59:45 +000068 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +000069XMLPUBFUN 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,
Daniel Veillard75b96822001-10-11 18:59:45 +000079 const xmlChar *type,
80 const xmlChar *orig,
81 const xmlChar *replace);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000082XMLPUBFUN int XMLCALL
83 xmlACatalogRemove (xmlCatalogPtr catal,
Daniel Veillard75b96822001-10-11 18:59:45 +000084 const xmlChar *value);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000085XMLPUBFUN xmlChar * XMLCALL
86 xmlACatalogResolve (xmlCatalogPtr catal,
Daniel Veillard75b96822001-10-11 18:59:45 +000087 const xmlChar *pubID,
88 const xmlChar *sysID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000089XMLPUBFUN xmlChar * XMLCALL
90 xmlACatalogResolveSystem(xmlCatalogPtr catal,
Daniel Veillard75b96822001-10-11 18:59:45 +000091 const xmlChar *sysID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000092XMLPUBFUN xmlChar * XMLCALL
93 xmlACatalogResolvePublic(xmlCatalogPtr catal,
Daniel Veillard75b96822001-10-11 18:59:45 +000094 const xmlChar *pubID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +000095XMLPUBFUN xmlChar * XMLCALL
96 xmlACatalogResolveURI (xmlCatalogPtr catal,
Daniel Veillard75b96822001-10-11 18:59:45 +000097 const xmlChar *URI);
Daniel Veillarda9cce9c2003-09-29 13:20:24 +000098#ifdef LIBXML_OUTPUT_ENABLED
Igor Zlatkovic76874e42003-08-25 09:05:12 +000099XMLPUBFUN void XMLCALL
100 xmlACatalogDump (xmlCatalogPtr catal,
Daniel Veillard75b96822001-10-11 18:59:45 +0000101 FILE *out);
Daniel Veillarda9cce9c2003-09-29 13:20:24 +0000102#endif /* LIBXML_OUTPUT_ENABLED */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000103XMLPUBFUN void XMLCALL
104 xmlFreeCatalog (xmlCatalogPtr catal);
105XMLPUBFUN int XMLCALL
106 xmlCatalogIsEmpty (xmlCatalogPtr catal);
Daniel Veillard75b96822001-10-11 18:59:45 +0000107
108/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000109 * Global operations.
Daniel Veillard75b96822001-10-11 18:59:45 +0000110 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000111XMLPUBFUN 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);
Daniel Veillarda9cce9c2003-09-29 13:20:24 +0000119#ifdef LIBXML_OUTPUT_ENABLED
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000120XMLPUBFUN void XMLCALL
121 xmlCatalogDump (FILE *out);
Daniel Veillarda9cce9c2003-09-29 13:20:24 +0000122#endif /* LIBXML_OUTPUT_ENABLED */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000123XMLPUBFUN xmlChar * XMLCALL
124 xmlCatalogResolve (const xmlChar *pubID,
Daniel Veillard344cee72001-08-20 00:08:40 +0000125 const xmlChar *sysID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000126XMLPUBFUN 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,
Daniel Veillard344cee72001-08-20 00:08:40 +0000134 const xmlChar *orig,
135 const xmlChar *replace);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000136XMLPUBFUN int XMLCALL
137 xmlCatalogRemove (const xmlChar *value);
138XMLPUBFUN xmlDocPtr XMLCALL
139 xmlParseCatalogFile (const char *filename);
140XMLPUBFUN int XMLCALL
141 xmlCatalogConvert (void);
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000142
143/*
144 * Strictly minimal interfaces for per-document catalogs used
145 * by the parser.
146 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000147XMLPUBFUN void XMLCALL
148 xmlCatalogFreeLocal (void *catalogs);
149XMLPUBFUN void * XMLCALL
150 xmlCatalogAddLocal (void *catalogs,
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000151 const xmlChar *URL);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000152XMLPUBFUN xmlChar * XMLCALL
153 xmlCatalogLocalResolve (void *catalogs,
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000154 const xmlChar *pubID,
155 const xmlChar *sysID);
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000156XMLPUBFUN xmlChar * XMLCALL
157 xmlCatalogLocalResolveURI(void *catalogs,
Daniel Veillarddc2cee22001-08-22 16:30:37 +0000158 const xmlChar *URI);
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000159/*
Daniel Veillard61f26172002-03-12 18:46:39 +0000160 * Preference settings.
Daniel Veillard5d90b6c2001-08-22 14:29:45 +0000161 */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000162XMLPUBFUN 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);
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000170
Daniel Veillard75b96822001-10-11 18:59:45 +0000171
Daniel Veillarde2940dd2001-08-22 00:06:49 +0000172/* DEPRECATED interfaces */
Igor Zlatkovic76874e42003-08-25 09:05:12 +0000173XMLPUBFUN const xmlChar * XMLCALL
174 xmlCatalogGetSystem (const xmlChar *sysID);
175XMLPUBFUN const xmlChar * XMLCALL
176 xmlCatalogGetPublic (const xmlChar *pubID);
Daniel Veillarda7374592001-05-10 14:17:55 +0000177
178#ifdef __cplusplus
179}
180#endif
181#endif /* LIBXML_CATALOG_ENABLED */
182#endif /* __XML_CATALOG_H__ */