/** * @since Ant 1.6 */ private XMLCatalog getRef() { if (!isReference()) { return this; } return getCheckedRef(XMLCatalog.class, "xmlcatalog"); }
/** * Creates the nested <code><dtd></code> element. Not * allowed if this catalog is itself a reference to another * catalog -- that is, a catalog cannot both refer to another * <em>and</em> contain elements or other attributes. * * @param dtd the information about the PUBLIC resource mapping to * be added to the catalog * @exception BuildException if this is a reference and no nested * elements are allowed. */ public void addDTD(ResourceLocation dtd) throws BuildException { if (isReference()) { throw noChildrenAllowed(); } getElements().addElement(dtd); setChecked(false); }
/** * Allows simple classpath string. Not allowed if this catalog is * itself a reference to another catalog -- that is, a catalog * cannot both refer to another <em>and</em> contain elements or * other attributes. * * @param classpath the classpath to use to look up entities. */ public void setClasspath(Path classpath) { if (isReference()) { throw tooManyAttributes(); } if (this.classpath == null) { this.classpath = classpath; } else { this.classpath.append(classpath); } setChecked(false); }
/** * Allows classpath reference. Not allowed if this catalog is * itself a reference to another catalog -- that is, a catalog * cannot both refer to another <em>and</em> contain elements or * other attributes. * * @param r an Ant reference containing a classpath. */ public void setClasspathRef(Reference r) { if (isReference()) { throw tooManyAttributes(); } createClasspath().setRefid(r); setChecked(false); }
/** * Allows catalogpath reference. Not allowed if this catalog is * itself a reference to another catalog -- that is, a catalog * cannot both refer to another <em>and</em> contain elements or * other attributes. * * @param r an Ant reference containing a classpath to be used as * the catalog path. */ public void setCatalogPathRef(Reference r) { if (isReference()) { throw tooManyAttributes(); } createCatalogPath().setRefid(r); setChecked(false); }
@Override protected synchronized void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException { if (isChecked()) { return; } if (isReference()) { super.dieOnCircularReference(stk, p); } else { if (classpath != null) { pushAndInvokeCircularReferenceCheck(classpath, stk, p); } if (catalogPath != null) { pushAndInvokeCircularReferenceCheck(catalogPath, stk, p); } setChecked(true); } }
/** * Allows nested classpath elements. Not allowed if this catalog * is itself a reference to another catalog -- that is, a catalog * cannot both refer to another <em>and</em> contain elements or * other attributes. * * @return a Path instance to be configured. */ public Path createClasspath() { if (isReference()) { throw noChildrenAllowed(); } if (this.classpath == null) { this.classpath = new Path(getProject()); } setChecked(false); return this.classpath.createPath(); }
/** Creates a nested <code><catalogpath></code> element. * Not allowed if this catalog is itself a reference to another * catalog -- that is, a catalog cannot both refer to another * <em>and</em> contain elements or other attributes. * * @return a path to be configured as the catalog path. * @exception BuildException * if this is a reference and no nested elements are allowed. */ public Path createCatalogPath() { if (isReference()) { throw noChildrenAllowed(); } if (this.catalogPath == null) { this.catalogPath = new Path(getProject()); } setChecked(false); return this.catalogPath.createPath(); }
throws TransformerException { if (isReference()) { return getRef().resolve(href, base);
/** * Implements the EntityResolver.resolveEntity() interface method. * @param publicId the public id to resolve. * @param systemId the system id to resolve. * @throws SAXException if there is a parsing problem. * @throws IOException if there is an IO problem. * @return the resolved entity. * @see org.xml.sax.EntityResolver#resolveEntity */ @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (isReference()) { return getRef().resolveEntity(publicId, systemId); } dieOnCircularReference(); log("resolveEntity: '" + publicId + "': '" + systemId + "'", Project.MSG_DEBUG); InputSource inputSource = getCatalogResolver().resolveEntity(publicId, systemId); if (inputSource == null) { log("No matching catalog entry found, parser will use: '" + systemId + "'", Project.MSG_DEBUG); } return inputSource; }
/** * Loads a nested <code><xmlcatalog></code> into our * definition. Not allowed if this catalog is itself a reference * to another catalog -- that is, a catalog cannot both refer to * another <em>and</em> contain elements or other attributes. * * @param catalog Nested XMLCatalog */ public void addConfiguredXMLCatalog(XMLCatalog catalog) { if (isReference()) { throw noChildrenAllowed(); } // Add all nested elements to our catalog getElements().addAll(catalog.getElements()); // Append the classpath of the nested catalog Path nestedClasspath = catalog.getClasspath(); createClasspath().append(nestedClasspath); // Append the catalog path of the nested catalog Path nestedCatalogPath = catalog.getCatalogPath(); createCatalogPath().append(nestedCatalogPath); setChecked(false); }