From 9f7b84bb07ab4f748ba981a38c7566cd48af60fa Mon Sep 17 00:00:00 2001
From: Daniel Veillard
Date: Thu, 23 Aug 2001 15:31:19 +0000
Subject: [PATCH] preparing for a 2.4.3 release even if it may not be ready yet
redirected
* Makefile.am configure.in include/libxml/xmlwin32version.h:
preparing for a 2.4.3 release even if it may not be ready yet
* catalog.c parser.c xmlIO.c include/libxml/catalog.h: redirected
all file parsing lookup to go through the entity resolver, add
to add an API to bypass it (needed to load catalogs themselves),
some cleanup on the catalog code too.
* nanoftp.c: small cleanup
* doc/catalog.html: small update
Daniel
---
ChangeLog | 11 +++++
Makefile.am | 3 +-
catalog.c | 83 ++++++++++++++++++++++++++++++--
config.h.in | 3 --
configure.in | 2 +-
doc/catalog.html | 11 +++--
include/libxml/catalog.h | 1 +
include/libxml/xmlwin32version.h | 8 +--
nanoftp.c | 1 -
parser.c | 15 +-----
xmlIO.c | 13 +++--
11 files changed, 114 insertions(+), 37 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index dd73f27c..9eac734b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Aug 23 17:26:58 CEST 2001 Daniel Veillard
+
+ * Makefile.am configure.in include/libxml/xmlwin32version.h:
+ preparing for a 2.4.3 release even if it may not be ready yet
+ * catalog.c parser.c xmlIO.c include/libxml/catalog.h: redirected
+ all file parsing lookup to go through the entity resolver, add
+ to add an API to bypass it (needed to load catalogs themselves),
+ some cleanup on the catalog code too.
+ * nanoftp.c: small cleanup
+ * doc/catalog.html: small update
+
Thu Aug 23 12:22:26 CEST 2001 Daniel Veillard
* catalog.c: fixed bugi #59406 in SGML catalog parsing reported by
diff --git a/Makefile.am b/Makefile.am
index 5a3f70db..9b2aa40f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -509,7 +509,8 @@ EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml.spec \
example/Makefile.am example/gjobread.c example/gjobs.xml \
$(man_MANS) libxml-2.0.pc.in \
vms/build_libxml.com vms/config.vms \
- strio.c strio.h trio.c trio.h triop.h libxml.h
+ trionan.c trionan.h strio.c strio.h trio.c trio.h \
+ triop.h triodef.h libxml.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libxml-2.0.pc
diff --git a/catalog.c b/catalog.c
index 2fec3b4d..c5961afa 100644
--- a/catalog.c
+++ b/catalog.c
@@ -58,6 +58,7 @@
typedef enum {
XML_CATA_NONE = 0,
XML_CATA_CATALOG,
+ XML_CATA_BROKEN_CATALOG,
XML_CATA_NEXT_CATALOG,
XML_CATA_PUBLIC,
XML_CATA_SYSTEM,
@@ -311,6 +312,71 @@ xmlCatalogUnWrapURN(const xmlChar *urn) {
return(xmlStrdup(result));
}
+/**
+ * xmlParseCatalogFile:
+ * @filename: the filename
+ *
+ * parse an XML file and build a tree. It's like xmlParseFile()
+ * except it bypass all catalog lookups.
+ *
+ * Returns the resulting document tree or NULL in case of error
+ */
+
+xmlDocPtr
+xmlParseCatalogFile(const char *filename) {
+ xmlDocPtr ret;
+ xmlParserCtxtPtr ctxt;
+ char *directory = NULL;
+ xmlParserInputPtr inputStream;
+ xmlParserInputBufferPtr buf;
+
+ ctxt = xmlNewParserCtxt();
+ if (ctxt == NULL) {
+ if (xmlDefaultSAXHandler.error != NULL) {
+ xmlDefaultSAXHandler.error(NULL, "out of memory\n");
+ }
+ return(NULL);
+ }
+
+ buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE);
+ if (buf == NULL) {
+ xmlFreeParserCtxt(ctxt);
+ return(NULL);
+ }
+
+ inputStream = xmlNewInputStream(ctxt);
+ if (inputStream == NULL) {
+ xmlFreeParserCtxt(ctxt);
+ return(NULL);
+ }
+
+ inputStream->filename = xmlMemStrdup(filename);
+ inputStream->buf = buf;
+ inputStream->base = inputStream->buf->buffer->content;
+ inputStream->cur = inputStream->buf->buffer->content;
+ inputStream->end =
+ &inputStream->buf->buffer->content[inputStream->buf->buffer->use];
+
+ inputPush(ctxt, inputStream);
+ if ((ctxt->directory == NULL) && (directory == NULL))
+ directory = xmlParserGetDirectory(filename);
+ if ((ctxt->directory == NULL) && (directory != NULL))
+ ctxt->directory = directory;
+
+ xmlParseDocument(ctxt);
+
+ if (ctxt->wellFormed)
+ ret = ctxt->myDoc;
+ else {
+ ret = NULL;
+ xmlFreeDoc(ctxt->myDoc);
+ ctxt->myDoc = NULL;
+ }
+ xmlFreeParserCtxt(ctxt);
+
+ return(ret);
+}
+
/************************************************************************
* *
* The XML Catalog parser *
@@ -585,7 +651,7 @@ xmlParseXMLCatalogFile(xmlCatalogPrefer prefer, const xmlChar *filename) {
if (filename == NULL)
return(NULL);
- doc = xmlParseFile((const char *) filename);
+ doc = xmlParseCatalogFile((const char *) filename);
if (doc == NULL) {
if (xmlDebugCatalogs)
xmlGenericError(xmlGenericErrorContext,
@@ -659,8 +725,10 @@ xmlFetchXMLCatalogFile(xmlCatalogEntryPtr catal) {
* Fetch and parse
*/
children = xmlParseXMLCatalogFile(catal->prefer, catal->value);
- if (children == NULL)
+ if (children == NULL) {
+ catal->type = XML_CATA_BROKEN_CATALOG;
return(-1);
+ }
/*
* Where a real test and set would be needed !
@@ -718,12 +786,13 @@ BAD_CAST "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd");
cur = catal;
while (cur != NULL) {
switch (cur->type) {
+ case XML_CATA_BROKEN_CATALOG:
case XML_CATA_CATALOG:
if (cur == catal) {
cur = cur->children;
continue;
}
- break;
+ break;
case XML_CATA_NEXT_CATALOG:
node = xmlNewDocNode(doc, ns, BAD_CAST "nextCatalog", NULL);
xmlSetProp(node, BAD_CAST "catalog", cur->value);
@@ -832,7 +901,9 @@ xmlAddXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *type,
xmlCatalogEntryPtr cur;
xmlCatalogEntryType typ;
- if ((catal == NULL) || (catal->type != XML_CATA_CATALOG))
+ if ((catal == NULL) ||
+ ((catal->type != XML_CATA_CATALOG) &&
+ (catal->type != XML_CATA_BROKEN_CATALOG)))
return(-1);
typ = xmlGetXMLCatalogEntryType(type);
if (typ == XML_CATA_NONE) {
@@ -888,7 +959,9 @@ xmlDelXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *value) {
xmlCatalogEntryPtr cur, prev, tmp;
int ret = 0;
- if ((catal == NULL) || (catal->type != XML_CATA_CATALOG))
+ if ((catal == NULL) ||
+ ((catal->type != XML_CATA_CATALOG) &&
+ (catal->type != XML_CATA_BROKEN_CATALOG)))
return(-1);
if (value == NULL)
return(-1);
diff --git a/config.h.in b/config.h.in
index 07ded072..bf54bc04 100644
--- a/config.h.in
+++ b/config.h.in
@@ -91,9 +91,6 @@
/* Define if you have the header file. */
#undef HAVE_DIRENT_H
-/* Define if you have the header file. */
-#undef HAVE_DLFCN_H
-
/* Define if you have the header file. */
#undef HAVE_ERRNO_H
diff --git a/configure.in b/configure.in
index cf59ef3a..622d9012 100644
--- a/configure.in
+++ b/configure.in
@@ -6,7 +6,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=4
-LIBXML_MICRO_VERSION=2
+LIBXML_MICRO_VERSION=3
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
diff --git a/doc/catalog.html b/doc/catalog.html
index e01b69a6..2ee09867 100644
--- a/doc/catalog.html
+++ b/doc/catalog.html
@@ -18,7 +18,7 @@ href="http://xmlsoft.org/catalog.html">http://xmlsoft.org/catalog.html
Mailing-list archive: http://mail.gnome.org/archives/xml/
-Version: $Revision: 1.1 $
+Version: $Revision: 1.2 $
Table of Content:
@@ -92,8 +92,7 @@ concrete example, suppose you are authoring a DocBook document, this one
starts with the following DOCTYPE definition:
<?xml version='1.0'?>
<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN"
- "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">
-
+ "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd">
When validating the document with libxml, the catalog will be
automatically consulted to lookup the public identifier "-//Norman Walsh//DTD
@@ -349,6 +348,10 @@ catalog state, those routines are primarily designed for xmlcatalog, I'm not
sure that exposing more complex interfaces (like navigation ones) would be
really useful.
+The xmlParseCatalogFile() is a function used to load XML Catalog files,
+it's similar as xmlParseFile() except it bypass all catalog lookups, it's
+provided because this functionality may be useful for client tools.
+
threaded environments:
Since the catalog tree is built progressively, some care has been taken to
@@ -385,6 +388,6 @@ me:
Daniel Veillard
-$Id: catalog.html,v 1.1 2001/08/22 23:44:08 veillard Exp $
+$Id: catalog.html,v 1.2 2001/08/23 00:52:23 veillard Exp $