Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 48146 invoked from network); 23 Oct 2003 08:43:26 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 23 Oct 2003 08:43:26 -0000 Received: (qmail 76266 invoked by uid 500); 23 Oct 2003 08:42:59 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 76099 invoked by uid 500); 23 Oct 2003 08:42:58 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 76086 invoked by uid 500); 23 Oct 2003 08:42:58 -0000 Received: (qmail 76083 invoked from network); 23 Oct 2003 08:42:58 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 23 Oct 2003 08:42:58 -0000 Received: (qmail 48116 invoked by uid 1146); 23 Oct 2003 08:43:23 -0000 Date: 23 Oct 2003 08:43:23 -0000 Message-ID: <20031023084323.48115.qmail@minotaur.apache.org> From: bodewig@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional TraXLiaison.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N bodewig 2003/10/23 01:43:22 Modified: src/main/org/apache/tools/ant/taskdefs/optional TraXLiaison.java Log: Register xmlcatalog as entity resolver for the stylesheet as well Revision Changes Path 1.31 +9 -8 ant/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java Index: TraXLiaison.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- TraXLiaison.java 17 Sep 2003 20:11:43 -0000 1.30 +++ TraXLiaison.java 23 Oct 2003 08:43:22 -0000 1.31 @@ -64,6 +64,7 @@ import java.io.OutputStream; import java.util.Vector; import java.util.Enumeration; +import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.ErrorListener; import javax.xml.transform.Source; @@ -86,6 +87,7 @@ import org.apache.tools.ant.util.JAXPUtils; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; +import org.xml.sax.SAXException; import org.xml.sax.XMLReader; /** @@ -199,7 +201,8 @@ * @return the configured source instance matching the stylesheet. * @throws Exception if there is a problem creating the source. */ - private Source getSource(InputStream is, File infile) throws Exception { + private Source getSource(InputStream is, File infile) + throws ParserConfigurationException, SAXException { // todo: is this comment still relevant ?? // FIXME: need to use a SAXSource as the source for the transform // so we can plug in our own entity resolver @@ -216,6 +219,8 @@ + "parser doesn't support SAX"); } } else { + // WARN: Don't use the StreamSource(File) ctor. It won't work with + // xalan prior to 2.2 because of systemid bugs. src = new StreamSource(is); } src.setSystemId(JAXPUtils.getSystemId(infile)); @@ -226,9 +231,8 @@ * Read in templates from the stylesheet */ private void readTemplates() - throws IOException, TransformerConfigurationException { - // WARN: Don't use the StreamSource(File) ctor. It won't work with - // xalan prior to 2.2 because of systemid bugs. + throws IOException, TransformerConfigurationException, + ParserConfigurationException, SAXException { // Use a stream so that you can close it yourself quickly // and avoid keeping the handle until the object is garbaged. @@ -239,10 +243,7 @@ xslStream = new BufferedInputStream(new FileInputStream(stylesheet)); templatesModTime = stylesheet.lastModified(); - StreamSource src = new StreamSource(xslStream); - // Always set the systemid to the source for imports, includes... - // in xsl and xml... - src.setSystemId(JAXPUtils.getSystemId(stylesheet)); + Source src = getSource(xslStream, stylesheet); templates = getFactory().newTemplates(src); } finally { if (xslStream != null) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org