Browse Source

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

<xmlcatalog id="one"/>
<xmlcatalog id="two">
  <xmlcatalog refid="one"/>
</xmlcatalog>
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
master
Erik Hatcher 23 years ago
parent
commit
169b689172
1 changed files with 20 additions and 2 deletions
  1. +20
    -2
      src/main/org/apache/tools/ant/types/XMLCatalog.java

+ 20
- 2
src/main/org/apache/tools/ant/types/XMLCatalog.java View File

@@ -83,8 +83,8 @@ import org.apache.tools.ant.util.FileUtils;
* <p>
* The object implemention <code>sometask</code> must provide a method called
* <code>createCatalog</code> which returns an instance of
* <code>XCatalog</code>. Nested dtd and entity definitions are handled by
* the XCatalog object and must be labeled <code>dtd</code> and
* <code>XMLCatalog</code>. Nested DTD and entity definitions are handled by
* the XMLCatalog object and must be labeled <code>dtd</code> and
* <code>entity</code> respectively.</p>
*
* <p>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.
*


Loading…
Cancel
Save