Author: jochen Date: Fri Jan 13 13:41:24 2006 New Revision: 368865 URL: http://svn.apache.org/viewcvs?rev=368865&view=rev Log: Added support for catalogs as URI/entity resolvers in the generators Ant task.
Modified: webservices/jaxme/branches/MAVEN/projects/jm/src/main/java/org/apache/ws/jaxme/generator/XJCTask.java Modified: webservices/jaxme/branches/MAVEN/projects/jm/src/main/java/org/apache/ws/jaxme/generator/XJCTask.java URL: http://svn.apache.org/viewcvs/webservices/jaxme/branches/MAVEN/projects/jm/src/main/java/org/apache/ws/jaxme/generator/XJCTask.java?rev=368865&r1=368864&r2=368865&view=diff ============================================================================== --- webservices/jaxme/branches/MAVEN/projects/jm/src/main/java/org/apache/ws/jaxme/generator/XJCTask.java (original) +++ webservices/jaxme/branches/MAVEN/projects/jm/src/main/java/org/apache/ws/jaxme/generator/XJCTask.java Fri Jan 13 13:41:24 2006 @@ -46,6 +46,7 @@ import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.XMLCatalog; import org.xml.sax.InputSource; import org.xml.sax.SAXParseException; @@ -239,6 +240,14 @@ * JDBC metadata.</td> * <td>0 - Unbounded</td> * </tr> + * <tr> + * <td>xmlCatalog</td> + * <td>Adds an XML catalog to our internal catalog, which is used + * to resolve external entities and URI's. See the + * <a href="http://ant.apache.org/manual/CoreTypes/xmlcatalog.html"> + * Ant documentation</a> for details on XML catalogs.</td> + * <td>0 - Unbounded</td> + * </tr> * </table> * <p>By default, the JaxMe ant task will always run the generator and create new files. This * is typically inappropriate for an ant script where your desire is to have as little @@ -335,6 +344,7 @@ private ClassType schemaReader; private List properties = new ArrayList(); private Dtd dtd; + private final XMLCatalog xmlCatalog = new XMLCatalog(); /** <p>Sets a property value. These properties may be used by the various source * generators to configure the behaviour. For example, the JDBC schema reader uses @@ -938,6 +948,23 @@ return null; } + /** + * Initialize internal instance of XMLCatalog + */ + public void init() { + super.init(); + xmlCatalog.setProject(getProject()); + } + + /** Adds an XML catalog to our internal catalog. See the + * <a href="http://ant.apache.org/manual/CoreTypes/xmlcatalog.html"> + * Ant documentation</a> for details on XML catalogs. + * @param xmlCatalog the XMLCatalog instance to use to look up DTDs + */ + public void addConfiguredXMLCatalog(XMLCatalog pXmlCatalog) { + xmlCatalog.addConfiguredXMLCatalog(pXmlCatalog); + } + public void execute() { java.lang.ClassLoader parent = Thread.currentThread().getContextClassLoader(); MyClassLoader cl = new MyClassLoader(parent == null ? getClass().getClassLoader() : parent); @@ -969,6 +996,7 @@ Generator generator = new GeneratorImpl(); + generator.setEntityResolver(xmlCatalog); generator.setForcingOverwrite(isForce()); generator.setSettingReadOnly(isReadOnly()); generator.setValidating(isValidating()); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]