ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant ProjectHelper.java
Date Thu, 14 Feb 2002 16:49:39 GMT
bodewig     02/02/14 08:49:39

  Modified:    src/main/org/apache/tools/ant ProjectHelper.java
  Log:
  Make Ant work with the AElfred parser which doesn't like to be used
  via SAX 1.
  
  Submitted by:	Andreas Voegele <voegelas@studenten.ims.uni-stuttgart.de>
  
  Revision  Changes    Path
  1.75      +12 -3     jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
  
  Index: ProjectHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- ProjectHelper.java	4 Feb 2002 11:03:04 -0000	1.74
  +++ ProjectHelper.java	14 Feb 2002 16:49:39 -0000	1.75
  @@ -69,7 +69,7 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.DocumentHandler;
   import org.xml.sax.AttributeList;
  -
  +import org.xml.sax.helpers.XMLReaderAdapter;
   
   import javax.xml.parsers.SAXParserFactory;
   import javax.xml.parsers.SAXParser;
  @@ -117,7 +117,11 @@
           
           try {
               SAXParser saxParser = getParserFactory().newSAXParser();
  -            parser = saxParser.getParser();
  +            try {
  +                parser = saxParser.getParser();
  +            } catch (SAXException exc) {
  +                parser = new XMLReaderAdapter(saxParser.getXMLReader());
  +            }
   
               String uri = "file:" + buildFile.getAbsolutePath().replace('\\', '/');
               for (int index = uri.indexOf('#'); index != -1; index = uri.indexOf('#')) {
  @@ -128,7 +132,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:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message