You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by xa...@xml.apache.org on 2004/09/24 17:30:23 UTC

[jira] Updated: (XALANJ-101) TransformerHandler not reusable

The following issue has been updated:

    Updater: Brian Minchau (mailto:minchau@ca.ibm.com)
       Date: Fri, 24 Sep 2004 8:28 AM
    Changes:
             Component changed to transformation
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/XALANJ-101?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XALANJ-101

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XALANJ-101
    Summary: TransformerHandler not reusable
       Type: Bug

     Status: Open

    Project: XalanJ2
 Components: 
             Xalan-interpretive transformation
             transformation
   Versions:
             2.0.1

   Assignee: Xalan Developers Mailing List
   Reporter: slobo

    Created: Tue, 3 Apr 2001 4:43 PM
    Updated: Fri, 24 Sep 2004 8:28 AM
Environment: Operating System: All
Platform: PC

Description:
import java.io.FileInputStream;
import javax.xml.transform.Templates;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import org.xml.sax.helpers.AttributesImpl;

public class Test {

	public static void main(String[] args) {
		try {
			SAXTransformerFactory f = (SAXTransformerFactory)
SAXTransformerFactory.newInstance();
			Templates t = f.newTemplates(new StreamSource(new 
FileInputStream("in.xsl")));
			TransformerHandler th = f.newTransformerHandler(t);
			th.setResult(new StreamResult(System.out));

			th.startDocument();
			th.startElement("","foo","foo",new AttributesImpl());
			th.endElement("","foo","foo");
			th.endDocument();

			th.startDocument();
			th.startElement("","foo","foo",new AttributesImpl());
			th.endElement("","foo","foo");
			th.endDocument();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
}

If you run this code with any valid in.xsl file, the template is instantiated 
only once.
It's true, that in JAXP-1.1 specification it is not explicitly stated that 
TransformerHandlers should be reusable, but it is stated that Transformers 
should be reusable, and my opinion is that it would be reasonable and natural 
to be able to reuse TransformerHandlers as well.


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org