[xsl] Usage of SourceLocator in TransformerException

Subject: [xsl] Usage of SourceLocator in TransformerException
From: Ellango Rajagopalan <rellango@xxxxxxxxx>
Date: Mon, 30 Jul 2001 14:15:57 -0700 (PDT)
Hi All:

I am transforming an XML file using an XSL file with
the code as below.

Document xmlDocument = dBuilder.parse(new
FileInputStream(xmlFile));
DOMSource domSource = new DOMSource(xmlDocument);
Transformer transformer = tFactory.newTransformer(new
StreamSource(new FileInputStream(xslFileName)));
try {
  transformer.transform(domSource, new StreamResult 
(outputFileName));
} catch (TransformerException tex) {
  System.out.println("TransformerException caught. " +
tex.getMessage());
}

The xslfile uses Xalan-Java extensions and calls a
method as below:

public String someMethod() throws TransformerException
{
   try {
        // some code
   } catch (Exception ex) {
     	throw new TransformerException(ex.getMessage (),
sourceLocator);
   }
}

My problem is in the usage of the SourceLocator in the
constructor
of the TransformerException. 
- How do I associate the SourceLocator to my XML file?
- I am using DOM, so I guess I need to use DOMLocator.
Both SourceLocator and DOMLocator are interfaces.
I am using Xalan-Java 2.0.0. The API document says
that
All Known Implementing Classes:
ElemTemplateElement, SAXSourceLocator.
These classes do not seem to be what I need. 
In any case, I still do not know how to construct and
associate an implementing class of this interface with
my xml, so that I can get debugging data from
exceptions.

Any help would be great.

Thanks.

Ellango

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread