From 169b689172f90489791d827c45f1671e6753db77 Mon Sep 17 00:00:00 2001 From: Erik Hatcher Date: Fri, 19 Apr 2002 03:13:36 +0000 Subject: [PATCH] Add nested XMLCatalog support, which will make grouping them in a build file a bit more flexible. This hasn't been tested other than to try that worked, but its straightforward enough that it (hopefully) won't break anything :) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272517 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/types/XMLCatalog.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/org/apache/tools/ant/types/XMLCatalog.java b/src/main/org/apache/tools/ant/types/XMLCatalog.java index 6316f37a3..23286f174 100644 --- a/src/main/org/apache/tools/ant/types/XMLCatalog.java +++ b/src/main/org/apache/tools/ant/types/XMLCatalog.java @@ -83,8 +83,8 @@ import org.apache.tools.ant.util.FileUtils; *

* The object implemention sometask must provide a method called * createCatalog which returns an instance of - * XCatalog. Nested dtd and entity definitions are handled by - * the XCatalog object and must be labeled dtd and + * XMLCatalog. Nested DTD and entity definitions are handled by + * the XMLCatalog object and must be labeled dtd and * entity respectively.

* *

Possible future extension could allow a catalog file instead of nested @@ -154,6 +154,24 @@ public class XMLCatalog extends DataType implements Cloneable, EntityResolver { addDTD(dtd); } + /** + * Loads a nested XMLCatalog into our definition + * + * @param catalog Nested XMLCatalog + */ + public void addConfiguredXMLCatalog(XMLCatalog catalog) { + if (isReference()) { + throw noChildrenAllowed(); + } + + Vector newElements = catalog.getElements(); + Vector ourElements = getElements(); + Enumeration enum = newElements.elements(); + while (enum.hasMoreElements()) { + ourElements.add(enum.nextElement()); + } + } + /** * Makes this instance in effect a reference to another XCatalog instance. *