Correct use of the ErrorListener in Xalan Transformations

Roger (archive)

Usenet Archive
Joined
Apr 14, 2000
Messages
151
Reaction score
0
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
 

GIMME

Usenet Archive
Joined
Jun 3, 2003
Messages
107
Reaction score
0
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
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top