Correct use of the ErrorListener in Xalan Transformations

R

Roger

I am transforming an XML stream from a third party application using
Xalan in a servlet. Every once in a while the application sends a
malformed XML document and I'm trying to find out which document it
is. I have created an ErrorListener class and registered it with the
Transformer object. The ErrorListener class is being called but when I
try to get the SourceLocator object back from the TransformerException
object I'm getting null returned. I've googled and can't find any code
examples that do anything than call getLocator() but I'm wondering if
I need to do configure anything else in the Transformer to cause it to
return a sourceLocator with the Exception or if I need to create my
own SourceLocator and pass it to the Transformer somehow? I would be
grateful for any guidance.

Regards
Roger
 
G

GIMME

Why don't you read the stream and convert that into a string,

then convert the string into a stream and then do the transform,

then if it fails print the string.

Another option is to use JDOM to do the transformation ...
JDOM uses xalan for it's transformations so why reinvent the wheel?

My 2 cents ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top