xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Jones <sjo...@picdar.co.uk>
Subject Re-using Transformers
Date Mon, 17 May 2004 11:07:29 GMT
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