TransformerException, getting the source

D

dado0583

Hi, I'm building an XSLT editor, and it does XSLT transformations using
the javax.xml.transform library. When there is a problem with the
stylesheet, e.g. a missing tag, or an element not having a required
attribute, it throws a TransformerException.
I want to get the line number of the source of the problem to give
back to the user so they can find where they are going wrong. I get the
SourceLocator object from the TransformerException, however, it is
always null and therefore I can't get the line number of the problem?

Can anyone give me any insights?

public void alertError(TransformerException e){
SourceLocator sl = e.getLocator();
//sl is always null!
}
 

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,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top