cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional TraXLiaison.java

2003-10-28 Thread bodewig
bodewig 2003/10/28 06:42:46

  Modified:src/main/org/apache/tools/ant/taskdefs/optional Tag:
ANT_16_BRANCH TraXLiaison.java
  Log:
  Resolve entities inside the stylesheet as well, merge from HEAD
  
  Revision  ChangesPath
  No   revision
  No   revision
  1.30.2.1  +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.30.2.1
  diff -u -r1.30 -r1.30.2.1
  --- TraXLiaison.java  17 Sep 2003 20:11:43 -  1.30
  +++ TraXLiaison.java  28 Oct 2003 14:42:46 -  1.30.2.1
  @@ -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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional TraXLiaison.java

2003-10-23 Thread bodewig
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  ChangesPath
  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 -  1.30
  +++ TraXLiaison.java  23 Oct 2003 08:43:22 -  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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]