releasing 2.4.9 fixing catalog breakages fixed more problems in catalog

* configure.in include/libxml/xmlwin32version.h: releasing 2.4.9
  fixing catalog breakages
* Makefile.am catalog.c result/catalogs/catal
  result/catalogs/mycatalog.* test/catalogs/catal*:
  fixed more problems in catalog support, added more regression tests
  for both XML and SGML catalog handling
Daniel
diff --git a/ChangeLog b/ChangeLog
index 0bc760c..a21e5bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Nov  6 16:21:33 CET 2001 Daniel Veillard <daniel@veillard.com>
+
+	* configure.in include/libxml/xmlwin32version.h: releasing 2.4.9
+	  fixing catalog breakages
+	* Makefile.am catalog.c result/catalogs/catal 
+	  result/catalogs/mycatalog.* test/catalogs/catal*:
+	  fixed more problems in catalog support, added more regression tests
+	  for both XML and SGML catalog handling
+
 Mon Nov  5 20:26:41 CET 2001 Daniel Veillard <daniel@veillard.com>
 
 	* debugXML.c: applied an improvement to xmlGetLineNo() from
diff --git a/Makefile.am b/Makefile.am
index 7cef609..118d08d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -419,6 +419,40 @@
 	      diff $(srcdir)/result/catalogs/$$name result.$$name ; \
 	      rm result.$$name ; \
 	  fi ; fi ; done)
+	@(for i in $(srcdir)/test/catalogs/*.script ; do \
+	  name=`basename $$i .script`; \
+	  sgml=$(srcdir)/test/catalogs/`basename $$i .script`.sgml; \
+	  if [ -f $$sgml ] ; then \
+	  if [ ! -f $(srcdir)/result/catalogs/$$name ] ; then \
+	      echo New test file $$name ; \
+	      $(top_builddir)/xmlcatalog --shell $$sgml < $$i > $(srcdir)/result/catalogs/$$name ; \
+	  else \
+	      echo Testing $$name ; \
+	      $(top_builddir)/xmlcatalog --shell $$sgml < $$i > result.$$name ; \
+	      grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0";\
+	      diff $(srcdir)/result/catalogs/$$name result.$$name ; \
+	      rm result.$$name ; \
+	  fi ; fi ; done)
+	@echo "Add and del operations on XML Catalogs"
+	@(xmlcatalog --create --noout result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	xmlcatalog --noout --add public Pubid sysid result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	xmlcatalog --noout --add public Pubid2 sysid2 result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	xmlcatalog --noout --add public Pubid3 sysid3 result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	diff result/catalogs/mycatalog.full result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	xmlcatalog --noout --del sysid result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	xmlcatalog --noout --del sysid3 result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	xmlcatalog --noout --del sysid2 result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	diff result/catalogs/mycatalog.empty result/catalogs/mycatalog; \
+	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0"; \
+	rm -f result/catalogs/mycatalog)
 
 SVGtests : xmllint
 	@echo "##"
diff --git a/catalog.c b/catalog.c
index e843d89..e5798ee 100644
--- a/catalog.c
+++ b/catalog.c
@@ -70,6 +70,7 @@
  ************************************************************************/
 
 typedef enum {
+    XML_CATA_REMOVED = -1,
     XML_CATA_NONE = 0,
     XML_CATA_CATALOG,
     XML_CATA_BROKEN_CATALOG,
@@ -105,6 +106,7 @@
     xmlCatalogEntryType type;
     xmlChar *name;
     xmlChar *value;
+    xmlChar *URL;  /* The expanded URL using the base */
     xmlCatalogPrefer prefer;
     int dealloc;
 };
@@ -193,7 +195,7 @@
  */
 static xmlCatalogEntryPtr
 xmlNewCatalogEntry(xmlCatalogEntryType type, const xmlChar *name,
-	           const xmlChar *value, xmlCatalogPrefer prefer) {
+	   const xmlChar *value, const xmlChar *URL, xmlCatalogPrefer prefer) {
     xmlCatalogEntryPtr ret;
 
     ret = (xmlCatalogEntryPtr) xmlMalloc(sizeof(xmlCatalogEntry));
@@ -214,6 +216,12 @@
 	ret->value = xmlStrdup(value);
     else
 	ret->value = NULL;
+    if (URL == NULL)
+	URL = value;
+    if (URL != NULL)
+	ret->URL = xmlStrdup(URL);
+    else
+	ret->URL = NULL;
     ret->prefer = prefer;
     ret->dealloc = 0;
     return(ret);
@@ -255,6 +263,8 @@
 	xmlFree(ret->name);
     if (ret->value != NULL)
 	xmlFree(ret->value);
+    if (ret->URL != NULL)
+	xmlFree(ret->URL);
     xmlFree(ret);
 }
 
@@ -470,6 +480,8 @@
     cur = catal;
     while (cur != NULL) {
 	switch (cur->type) {
+	    case XML_CATA_REMOVED:
+		break;
 	    case XML_CATA_BROKEN_CATALOG:
 	    case XML_CATA_CATALOG:
 		if (cur == catal) {
@@ -983,7 +995,7 @@
 		xmlGenericError(xmlGenericErrorContext,
 			"Found %s: '%s'\n", name, URL);
 	}
-	ret = xmlNewCatalogEntry(type, nameValue, URL, prefer);
+	ret = xmlNewCatalogEntry(type, nameValue, uriValue, URL, prefer);
     } else {
 	xmlGenericError(xmlGenericErrorContext,
 		"%s entry '%s' broken ?: %s\n", name, uriAttrName, uriValue);
@@ -1157,7 +1169,7 @@
 	(xmlStrEqual(cur->ns->href, XML_CATALOGS_NAMESPACE))) {
 
 	parent = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
-		                    (const xmlChar *)filename, prefer);
+				    (const xmlChar *)filename, NULL, prefer);
         if (parent == NULL) {
 	    xmlFreeDoc(doc);
 	    return(NULL);
@@ -1202,7 +1214,7 @@
 
     if (catal == NULL) 
 	return(-1);
-    if (catal->value == NULL)
+    if (catal->URL == NULL)
 	return(-1);
     if (catal->children != NULL)
 	return(-1);
@@ -1219,11 +1231,11 @@
 
     if (xmlCatalogXMLFiles != NULL) {
 	doc = (xmlCatalogEntryPtr)
-	    xmlHashLookup(xmlCatalogXMLFiles, catal->value);
+	    xmlHashLookup(xmlCatalogXMLFiles, catal->URL);
 	if (doc != NULL) {
 	    if (xmlDebugCatalogs)
 		xmlGenericError(xmlGenericErrorContext,
-		    "Found %s in file hash\n", catal->value);
+		    "Found %s in file hash\n", catal->URL);
 
 	    if (catal->type == XML_CATA_CATALOG)
 		catal->children = doc->children;
@@ -1235,7 +1247,7 @@
 	}
 	if (xmlDebugCatalogs)
 	    xmlGenericError(xmlGenericErrorContext,
-		"%s not found in file hash\n", catal->value);
+		"%s not found in file hash\n", catal->URL);
     }
 
     /*
@@ -1243,7 +1255,7 @@
      * use the existing catalog, there is no recusivity allowed at
      * that level.
      */
-    doc = xmlParseXMLCatalogFile(catal->prefer, catal->value);
+    doc = xmlParseXMLCatalogFile(catal->prefer, catal->URL);
     if (doc == NULL) {
 	catal->type = XML_CATA_BROKEN_CATALOG;
 	xmlRMutexUnlock(xmlCatalogMutex);
@@ -1262,8 +1274,8 @@
     if (xmlCatalogXMLFiles != NULL) {
 	if (xmlDebugCatalogs)
 	    xmlGenericError(xmlGenericErrorContext,
-		"%s added to file hash\n", catal->value);
-	xmlHashAddEntry(xmlCatalogXMLFiles, catal->value, doc);
+		"%s added to file hash\n", catal->URL);
+	xmlHashAddEntry(xmlCatalogXMLFiles, catal->URL, doc);
     }
     xmlRMutexUnlock(xmlCatalogMutex);
     return(0);
@@ -1292,6 +1304,7 @@
 	      const xmlChar *orig, const xmlChar *replace) {
     xmlCatalogEntryPtr cur;
     xmlCatalogEntryType typ;
+    int doregister = 0;
 
     if ((catal == NULL) || 
 	((catal->type != XML_CATA_CATALOG) &&
@@ -1300,6 +1313,9 @@
     if (catal->children == NULL) {
 	xmlFetchXMLCatalogFile(catal);
     }
+    if (catal->children == NULL)
+	doregister = 1;
+
     typ = xmlGetXMLCatalogEntryType(type);
     if (typ == XML_CATA_NONE) {
 	if (xmlDebugCatalogs)
@@ -1321,7 +1337,10 @@
 			    "Updating element %s to catalog\n", type);
 		if (cur->value != NULL)
 		    xmlFree(cur->value);
+		if (cur->URL != NULL)
+		    xmlFree(cur->URL);
 		cur->value = xmlStrdup(replace);
+		cur->URL = xmlStrdup(replace);
 		return(0);
 	    }
 	    if (cur->next == NULL)
@@ -1333,9 +1352,17 @@
 	xmlGenericError(xmlGenericErrorContext,
 		"Adding element %s to catalog\n", type);
     if (cur == NULL)
-	catal->children = xmlNewCatalogEntry(typ, orig, replace, catal->prefer);
+	catal->children = xmlNewCatalogEntry(typ, orig, replace,
+		                             NULL, catal->prefer);
     else
-	cur->next = xmlNewCatalogEntry(typ, orig, replace, catal->prefer);
+	cur->next = xmlNewCatalogEntry(typ, orig, replace,
+		                       NULL, catal->prefer);
+    if (doregister) {
+	cur = xmlHashLookup(xmlCatalogXMLFiles, catal->URL);
+	if (cur != NULL)
+	    cur->children = catal->children;
+    }
+
     return(0);
 }
 
@@ -1351,7 +1378,7 @@
  */
 static int
 xmlDelXMLCatalog(xmlCatalogEntryPtr catal, const xmlChar *value) {
-    xmlCatalogEntryPtr cur, prev, tmp;
+    xmlCatalogEntryPtr cur;
     int ret = 0;
 
     if ((catal == NULL) || 
@@ -1368,7 +1395,6 @@
      * Scan the children
      */
     cur = catal->children;
-    prev = NULL;
     while (cur != NULL) {
 	if (((cur->name != NULL) && (xmlStrEqual(value, cur->name))) ||
 	    (xmlStrEqual(value, cur->value))) {
@@ -1380,18 +1406,8 @@
 		    xmlGenericError(xmlGenericErrorContext,
 			    "Removing element %s from catalog\n", cur->value);
 	    }
-	    ret++;
-	    tmp = cur;
-	    cur = tmp->next;
-	    if (prev == NULL) {
-		catal->children = cur;
-	    } else {
-		prev->next = cur;
-	    }
-            xmlFreeCatalogEntry(tmp);
-	    continue;
+	    cur->type = XML_CATA_REMOVED;
 	}
-	prev = cur;
 	cur = cur->next;
     }
     return(ret);
@@ -1434,7 +1450,7 @@
 			if (xmlDebugCatalogs)
 			    xmlGenericError(xmlGenericErrorContext,
 				    "Found system match %s\n", cur->name);
-			return(xmlStrdup(cur->value));
+			return(xmlStrdup(cur->URL));
 		    }
 		    break;
 		case XML_CATA_REWRITE_SYSTEM:
@@ -1461,7 +1477,7 @@
 	    if (xmlDebugCatalogs)
 		xmlGenericError(xmlGenericErrorContext,
 			"Using rewriting rule %s\n", rewrite->name);
-	    ret = xmlStrdup(rewrite->value);
+	    ret = xmlStrdup(rewrite->URL);
 	    if (ret != NULL)
 		ret = xmlStrcat(ret, &sysID[lenrewrite]);
 	    return(ret);
@@ -1479,14 +1495,14 @@
 		if ((cur->type == XML_CATA_DELEGATE_SYSTEM) &&
 		    (!xmlStrncmp(sysID, cur->name, xmlStrlen(cur->name)))) {
 		    for (i = 0;i < nbList;i++)
-			if (xmlStrEqual(cur->value, delegates[i]))
+			if (xmlStrEqual(cur->URL, delegates[i]))
 			    break;
 		    if (i < nbList) {
 			cur = cur->next;
 			continue;
 		    }
 		    if (nbList < MAX_DELEGATE)
-			delegates[nbList++] = cur->value;
+			delegates[nbList++] = cur->URL;
 
 		    if (cur->children == NULL) {
 			xmlFetchXMLCatalogFile(cur);
@@ -1494,7 +1510,7 @@
 		    if (cur->children != NULL) {
 			if (xmlDebugCatalogs)
 			    xmlGenericError(xmlGenericErrorContext,
-				    "Trying system delegate %s\n", cur->value);
+				    "Trying system delegate %s\n", cur->URL);
 			ret = xmlCatalogListXMLResolve(
 				cur->children, NULL, sysID);
 			if (ret != NULL)
@@ -1522,7 +1538,7 @@
 			if (xmlDebugCatalogs)
 			    xmlGenericError(xmlGenericErrorContext,
 				    "Found public match %s\n", cur->name);
-			return(xmlStrdup(cur->value));
+			return(xmlStrdup(cur->URL));
 		    }
 		    break;
 		case XML_CATA_DELEGATE_PUBLIC:
@@ -1554,14 +1570,14 @@
 		    (!xmlStrncmp(pubID, cur->name, xmlStrlen(cur->name)))) {
 
 		    for (i = 0;i < nbList;i++)
-			if (xmlStrEqual(cur->value, delegates[i]))
+			if (xmlStrEqual(cur->URL, delegates[i]))
 			    break;
 		    if (i < nbList) {
 			cur = cur->next;
 			continue;
 		    }
 		    if (nbList < MAX_DELEGATE)
-			delegates[nbList++] = cur->value;
+			delegates[nbList++] = cur->URL;
 			    
 		    if (cur->children == NULL) {
 			xmlFetchXMLCatalogFile(cur);
@@ -1569,7 +1585,7 @@
 		    if (cur->children != NULL) {
 			if (xmlDebugCatalogs)
 			    xmlGenericError(xmlGenericErrorContext,
-				    "Trying public delegate %s\n", cur->value);
+				    "Trying public delegate %s\n", cur->URL);
 			ret = xmlCatalogListXMLResolve(
 				cur->children, pubID, NULL);
 			if (ret != NULL)
@@ -1645,7 +1661,7 @@
 		    if (xmlDebugCatalogs)
 			xmlGenericError(xmlGenericErrorContext,
 				"Found URI match %s\n", cur->name);
-		    return(xmlStrdup(cur->value));
+		    return(xmlStrdup(cur->URL));
 		}
 		break;
 	    case XML_CATA_REWRITE_URI:
@@ -1672,7 +1688,7 @@
 	if (xmlDebugCatalogs)
 	    xmlGenericError(xmlGenericErrorContext,
 		    "Using rewriting rule %s\n", rewrite->name);
-	ret = xmlStrdup(rewrite->value);
+	ret = xmlStrdup(rewrite->URL);
 	if (ret != NULL)
 	    ret = xmlStrcat(ret, &URI[lenrewrite]);
 	return(ret);
@@ -1690,14 +1706,14 @@
 	    if ((cur->type == XML_CATA_DELEGATE_SYSTEM) &&
 		(!xmlStrncmp(URI, cur->name, xmlStrlen(cur->name)))) {
 		for (i = 0;i < nbList;i++)
-		    if (xmlStrEqual(cur->value, delegates[i]))
+		    if (xmlStrEqual(cur->URL, delegates[i]))
 			break;
 		if (i < nbList) {
 		    cur = cur->next;
 		    continue;
 		}
 		if (nbList < MAX_DELEGATE)
-		    delegates[nbList++] = cur->value;
+		    delegates[nbList++] = cur->URL;
 
 		if (cur->children == NULL) {
 		    xmlFetchXMLCatalogFile(cur);
@@ -1705,7 +1721,7 @@
 		if (cur->children != NULL) {
 		    if (xmlDebugCatalogs)
 			xmlGenericError(xmlGenericErrorContext,
-				"Trying URI delegate %s\n", cur->value);
+				"Trying URI delegate %s\n", cur->URL);
 		    ret = xmlCatalogListXMLResolveURI(
 			    cur->children, URI);
 		    if (ret != NULL)
@@ -2209,7 +2225,7 @@
 		    xmlCatalogEntryPtr entry;
 
 		    entry = xmlNewCatalogEntry(type, name, filename,
-			                       XML_CATA_PREFER_NONE);
+			                       NULL, XML_CATA_PREFER_NONE);
 		    res = xmlHashAddEntry(catal->sgml, name, entry);
 		    if (res < 0) {
 			xmlFreeCatalogEntry(entry);
@@ -2221,7 +2237,7 @@
 		if (super) {
 		    xmlCatalogEntryPtr entry;
 
-		    entry = xmlNewCatalogEntry(type, sysid, NULL,
+		    entry = xmlNewCatalogEntry(type, sysid, NULL, NULL,
 			                       XML_CATA_PREFER_NONE);
 		    res = xmlHashAddEntry(catal->sgml, sysid, entry);
 		    if (res < 0) {
@@ -2279,7 +2295,7 @@
     if (entry == NULL)
 	return(NULL);
     if (entry->type == SGML_CATA_PUBLIC)
-	return(entry->value);
+	return(entry->URL);
     return(NULL);
 }
 
@@ -2303,7 +2319,7 @@
     if (entry == NULL)
 	return(NULL);
     if (entry->type == SGML_CATA_SYSTEM)
-	return(entry->value);
+	return(entry->URL);
     return(NULL);
 }
 
@@ -2425,7 +2441,7 @@
 	    xmlFree(content);
 	    return(NULL);
 	}
-        catal->xml = xmlNewCatalogEntry(XML_CATA_CATALOG,
+        catal->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
 		       NULL, BAD_CAST filename, xmlCatalogDefaultPrefer);
     }
     xmlFree(content);
@@ -2466,7 +2482,7 @@
 	xmlFree(content);
     } else {
 	xmlCatalogEntryPtr tmp, cur;
-	tmp = xmlNewCatalogEntry(XML_CATA_CATALOG,
+	tmp = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
 		       NULL, BAD_CAST filename, xmlCatalogDefaultPrefer);
 
 	cur = catal->xml;
@@ -2679,7 +2695,7 @@
         if (cattype != XML_CATA_NONE) {
             xmlCatalogEntryPtr entry;
 
-            entry = xmlNewCatalogEntry(cattype, orig, replace,
+            entry = xmlNewCatalogEntry(cattype, orig, replace, NULL,
                                        XML_CATA_PREFER_NONE);
 	    if (catal->sgml == NULL)
 		catal->sgml = xmlHashCreate(10);
@@ -2829,7 +2845,7 @@
 	catal = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE, xmlCatalogDefaultPrefer);
 	if (catal != NULL) {
 
-	    catal->xml = xmlNewCatalogEntry(XML_CATA_CATALOG,
+	    catal->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
 			   NULL, BAD_CAST catalogs, xmlCatalogDefaultPrefer);
 
 	    xmlDefaultCatalog = catal;
@@ -3068,7 +3084,7 @@
 	xmlDefaultCatalog = xmlCreateNewCatalog(XML_XML_CATALOG_TYPE,
 		                          xmlCatalogDefaultPrefer);
 	xmlDefaultCatalog->xml = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL,
-				    orig, xmlCatalogDefaultPrefer);
+				    orig, NULL,  xmlCatalogDefaultPrefer);
 
 	xmlRMutexUnlock(xmlCatalogMutex);
 	return(0);
@@ -3273,7 +3289,7 @@
 	xmlGenericError(xmlGenericErrorContext,
 		"Adding document catalog %s\n", URL);
 
-    add = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL, URL,
+    add = xmlNewCatalogEntry(XML_CATA_CATALOG, NULL, URL, NULL,
 	                     xmlCatalogDefaultPrefer);
     if (add == NULL)
 	return(catalogs);
diff --git a/configure.in b/configure.in
index 88d4ac1..f77f1c1 100644
--- a/configure.in
+++ b/configure.in
@@ -6,7 +6,7 @@
 
 LIBXML_MAJOR_VERSION=2
 LIBXML_MINOR_VERSION=4
-LIBXML_MICRO_VERSION=8
+LIBXML_MICRO_VERSION=9
 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/include/libxml/xmlwin32version.h b/include/libxml/xmlwin32version.h
index 5c2c0d4..3254995 100644
--- a/include/libxml/xmlwin32version.h
+++ b/include/libxml/xmlwin32version.h
@@ -27,21 +27,21 @@
  *
  * the version string like "1.2.3"
  */
-#define LIBXML_DOTTED_VERSION "2.4.8"
+#define LIBXML_DOTTED_VERSION "2.4.9"
 
 /**
  * LIBXML_VERSION:
  *
  * the version number: 1.2.3 value is 1002003
  */
-#define LIBXML_VERSION 20408
+#define LIBXML_VERSION 20409
 
 /**
  * LIBXML_VERSION_STRING:
  *
  * the version number string, 1.2.3 value is "1002003"
  */
-#define LIBXML_VERSION_STRING "20408"
+#define LIBXML_VERSION_STRING "20409"
 
 /**
  * LIBXML_TEST_VERSION:
@@ -49,7 +49,7 @@
  * Macro to check that the libxml version in use is compatible with
  * the version the software has been compiled against
  */
-#define LIBXML_TEST_VERSION xmlCheckVersion(20408);
+#define LIBXML_TEST_VERSION xmlCheckVersion(20409);
 
 #if 0
 /**
diff --git a/result/catalogs/catal b/result/catalogs/catal
new file mode 100644
index 0000000..52b2afe
--- /dev/null
+++ b/result/catalogs/catal
@@ -0,0 +1,5 @@
+> test/catalogs/calstblx.dtd
+> test/catalogs/docbook.dtd
+> test/catalogs/soextblx.dtd
+> test/catalogs/dbgenent.mod
+> 
\ No newline at end of file
diff --git a/result/catalogs/mycatalog.empty b/result/catalogs/mycatalog.empty
new file mode 100644
index 0000000..84f482e
--- /dev/null
+++ b/result/catalogs/mycatalog.empty
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"/>
diff --git a/result/catalogs/mycatalog.full b/result/catalogs/mycatalog.full
new file mode 100644
index 0000000..1e30fa2
--- /dev/null
+++ b/result/catalogs/mycatalog.full
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+<public publicId="Pubid" uri="sysid"/>
+<public publicId="Pubid2" uri="sysid2"/>
+<public publicId="Pubid3" uri="sysid3"/>
+</catalog>
diff --git a/test/catalogs/catal.script b/test/catalogs/catal.script
new file mode 100644
index 0000000..1c644d1
--- /dev/null
+++ b/test/catalogs/catal.script
@@ -0,0 +1,4 @@
+public "-//OASIS//DTD DocBook XML CALS Table Model V4.1//EN"
+public "-//Davenport//DTD DocBook V3.0//EN"
+public "-//OASIS//DTD XML Exchange Table Model 19990315//EN"
+public "-//Davenport//ENTITIES DocBook Additional General Entities V3.0//EN"
diff --git a/test/catalogs/catal.sgml b/test/catalogs/catal.sgml
new file mode 100644
index 0000000..03fc2c5
--- /dev/null
+++ b/test/catalogs/catal.sgml
@@ -0,0 +1,2 @@
+CATALOG catal1.sgml
+CATALOG catal2.sgml
diff --git a/test/catalogs/catal1.sgml b/test/catalogs/catal1.sgml
new file mode 100644
index 0000000..b8319ca
--- /dev/null
+++ b/test/catalogs/catal1.sgml
@@ -0,0 +1 @@
+CATALOG catal3.sgml
diff --git a/test/catalogs/catal2.sgml b/test/catalogs/catal2.sgml
new file mode 100644
index 0000000..ff4cf8c
--- /dev/null
+++ b/test/catalogs/catal2.sgml
@@ -0,0 +1,4 @@
+PUBLIC "-//Davenport//DTD DocBook V3.0//EN" "docbook.dtd"
+PUBLIC "-//USA-DOD//DTD Table Model 951010//EN" "cals-tbl.dtd"
+PUBLIC "-//Davenport//ELEMENTS DocBook Information Pool V3.0//EN" "dbpool.mod"
+PUBLIC "-//Davenport//ELEMENTS DocBook Document Hierarchy V3.0//EN" "dbhier.mod"PUBLIC "-//Davenport//ENTITIES DocBook Additional General Entities V3.0//EN" "dbgenent.mod"
diff --git a/test/catalogs/catal3.sgml b/test/catalogs/catal3.sgml
new file mode 100644
index 0000000..bf54724
--- /dev/null
+++ b/test/catalogs/catal3.sgml
@@ -0,0 +1,8 @@
+PUBLIC "-//OASIS//DTD DocBook XML CALS Table Model V4.1//EN" "calstblx.dtd"
+PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" "soextblx.dtd"
+PUBLIC "-//OASIS//ELEMENTS DocBook XML Information Pool V4.1//EN" "dbpool.mod"
+PUBLIC "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.1//EN" "dbhier.mod"PUBLIC "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.1//EN" "dbgenent.mod"
+PUBLIC "-//OASIS//ENTITIES DocBook XML Notations V4.1//EN" "dbnotn.mod"
+PUBLIC "-//OASIS//ENTITIES DocBook XML Character Entities V4.1//EN" "dbcent.mod"
+
+