xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Hersht <ig...@ca.ibm.com>
Subject Re: Re-using Transformers
Date Mon, 17 May 2004 16:47:49 GMT




You should be able to reuse Transformers.
You can take a look at java\samples\TransformThread to verify
if your usage is correct.
Open defect in http://nagoya.apache.org/bugzilla
if your usage is correct.


Igor Hersht
XSLT Development
IBM Canada Ltd., 8200 Warden Avenue, Markham, Ontario L6G 1C7
Office D2-260, Phone (905)413-3240 ; FAX  (905)413-4839


                                                                           
             Steve Jones                                                   
             <sjones@picdar.co                                             
             .uk>                                                       To 
                                       <xalan-j-users@xml.apache.org>      
             05/17/2004 07:07                                           cc 
             AM                                                            
                                                                   Subject 
                                       Re-using Transformers               
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi,

I'm in the process of developing an application that uses XSLT Transformers
multiple times. To save the overhead of re-creating the Transformer object
each time, I thought I'd keep a reference to the transformer around, and
pass new XML documents to it as required.

Unfortunately, I don't seem to be able to re-use a Transformer once it's
been used once - a NullPointerException is thrown somewhere deep in the
code.

I haven't had time to examine the source code to try and figure out what
the
problem is yet, but I was hoping that someone could shed light on the
matter
in the meantime (I've included the stack trace below).

I suppose the ultimate question is: Is it even possible to re-use a
Transformer? And if so, how?

Thanks in advance,
Steve.

STACK TRACE (apologies if it wraps)
===================================

javax.xml.transform.TransformerException: java.lang.NullPointerException
    at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j

ava:1226)
    at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:

638)
    at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:

1088)
    at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:

1066)
    at ........
---------
java.lang.NullPointerException
    at
org.apache.xpath.objects.XNodeSet.dispatchCharactersEvents(XNodeSet.java:262

)
    at
org.apache.xpath.Expression.executeCharsToContentHandler(Expression.java:303

)
    at org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:319)
    at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform

erImpl.java:2182)
    at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:

678)
    at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform

erImpl.java:2182)
    at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:200)
    at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform

erImpl.java:2182)
    at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:

678)
    at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform

erImpl.java:2182)
    at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:

678)
    at
org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.ja

va:426)
    at org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:287)
    at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform

erImpl.java:2182)
    at
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:

678)
    at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform

erImpl.java:2182)
    at
org.apache.xalan.templates.ElemElement.constructNode(ElemElement.java:414)
    at org.apache.xalan.templates.ElemElement.execute(ElemElement.java:363)
    at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Transform

erImpl.java:2182)
    at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Transformer

Impl.java:2008)
    at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.j

ava:1171)
    at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:

638)
    at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:

1088)
    at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:

1066)
    at .........




Mime
View raw message