[prev in list] [next in list] [prev in thread] [next in thread]
List: velocity-dev
Subject: [PATCH] for Bug (enhancement) 12191 <xmlcatalog> nested element
From: "Andrew Stevens" <ats37 () hotmail ! com>
Date: 2002-09-05 20:14:54
[Download RAW message or body]
Hello, folks.
I'm at a machine with diff now, so here's a patch file for the modified
AnakiaTask.java I attached earlier to the bug report (
http://issues.apache.org/bugzilla/show_bug.cgi?id=12191 )
It adds optional nested elements to the anakia task for <xmlcatalog> and
<dtd>, with the same syntax as the Ant xmlvalidate task (unsurprisingly,
since it uses the standard Ant types to do it and I lifted most of the code
from Ant's own source).
Hope this can be applied reasonably soon; without it I can't build xdoclet
behind the firewall at work (I get no such host xdoclet.sourceforge.net
exceptions), but if I commit a modified version of velocity's jar to
xdoclet's CVS it'll break a whole bunch of GUMP builds...
Andrew.
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
["xmlcatalog.txt" (text/plain)]
Index: jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java
===================================================================
RCS file:
/home/cvspublic/jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java,v
retrieving revision 1.33
diff -u -r1.33 AnakiaTask.java
--- jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java 9
Nov 2001 00:12:56 -0000 1.33
+++ jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java 5
Sep 2002 19:56:12 -0000
@@ -66,6 +66,8 @@
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.types.DTDLocation;
+import org.apache.tools.ant.types.XMLCatalog;
import org.xml.sax.SAXParseException;
@@ -140,6 +142,9 @@
/** the VelocityEngine instance to use */
private VelocityEngine ve = new VelocityEngine();
+ /** for resolving entities such as dtds */
+ private XMLCatalog xmlCatalog = new XMLCatalog();
+
/**
* Constructor creates the SAXBuilder.
*/
@@ -238,6 +243,32 @@
}
/**
+ * add an XMLCatalog as a nested element; optional.
+ */
+ public void addConfiguredXMLCatalog(XMLCatalog catalog) {
+ xmlCatalog.addConfiguredXMLCatalog(catalog);
+ }
+
+ /**
+ * Create a DTD location record; optional.
+ * This stores the location of a DTD. The DTD is identified
+ * by its public Id.
+ */
+ public DTDLocation createDTD() {
+ DTDLocation dtdLocation = new DTDLocation();
+ xmlCatalog.addDTD(dtdLocation);
+ return dtdLocation;
+ }
+
+ /**
+ * Initialize internal instance of XMLCatalog
+ */
+ public void init() throws BuildException {
+ super.init();
+ xmlCatalog.setProject(project);
+ }
+
+ /**
* Main body of the application
*/
public void execute () throws BuildException
@@ -294,6 +325,9 @@
}
}
+ // use the supplied xmlCatalog to resolve DTDs etc. when reading
source files
+ builder.setEntityResolver(xmlCatalog);
+
Document projectDocument = null;
try
{
--
To unsubscribe, e-mail: <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-dev-help@jakarta.apache.org>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic