I've read an article about problems with the AElfred parser in the
ant-user list archive. AElfred comes with the XSLT processor Saxon.
The problem is that jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
uses the deprecated SAX1 API, which is not supported by AElfred.
The following patch modifies ProjectHelper.java so that a SAX2 XMLReader
and an XMLReaderAdapter are used if no SAX1 parser is available.
I've tested this patch with AElfred, Crimson and Xerces.
--- jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java.orig Thu Feb 14
12:00:54 2002
+++ jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java Thu Feb 14
+12:56:38 2002
@@ -117,7 +117,12 @@
try {
SAXParser saxParser = getParserFactory().newSAXParser();
- parser = saxParser.getParser();
+ try {
+ parser = saxParser.getParser();
+ }
+ catch (SAXException exc) {
+ parser = new
+org.xml.sax.helpers.XMLReaderAdapter(saxParser.getXMLReader());
+ }
String uri = "file:" + buildFile.getAbsolutePath().replace('\\', '/');
for (int index = uri.indexOf('#'); index != -1; index = uri.indexOf('#'))
{
@@ -128,7 +133,12 @@
inputSource = new InputSource(inputStream);
inputSource.setSystemId(uri);
project.log("parsing buildfile " + buildFile + " with URI = " + uri,
Project.MSG_VERBOSE);
- saxParser.parse(inputSource, new RootHandler());
+ HandlerBase hb = new RootHandler();
+ parser.setDocumentHandler(hb);
+ parser.setEntityResolver(hb);
+ parser.setErrorHandler(hb);
+ parser.setDTDHandler(hb);
+ parser.parse(inputSource);
}
catch(ParserConfigurationException exc) {
throw new BuildException("Parser has not been configured correctly", exc);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>