You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Ben Mesander <Be...@creativecorp.com> on 2000/06/06 01:59:58 UTC
XSLTProcessor.setProblemListener
Hi,
I'm mailing this list because I get a 'permission denied' when I try
to get to the URL: http://xml.apache.org/bugs/
Is it a known bug that after calling XSLTProcessor.setProblemListener
() with the default DTM parser, and a parse error occurs in the XML
while applying a compiled stylesheet, the ProblemListener that was set
doesn't get called?
It's likely I'm calling things wrong, but I just wanted to search and
see if someone had reported this bug before.
I'm calling xalan like so (we'll see how bad email clients mangle
this):
/**********************************************************************
* Performs an actual transformation
*
* @return true if the transformation is possible, and is done. false
* means the transformation is not possible, and it was not done.
* @exception various exceptions are thrown on error.
*/
public boolean transform ()
throws DfException, FileNotFoundException,
StreamCorruptedException, SAXException, IOException,
OptionalDataException, ClassNotFoundException
{
File docInputFile;
InputStream docInputStream;
XSLTProcessor processor;
XSLTInputSource input;
ObjectInputStream styleInput;
StylesheetRoot stylesheet;
File styleFile;
boolean converted = false;
XSLTResultTarget output;
styleFile = getStylePath ();
if (styleFile != null)
{
processor = XSLTProcessorFactory.getProcessor ();
processor.setProblemListener (new
com.creativecorp.km.xml.ProblemListener ());
docInputFile = new File (_document.getFileEx (null,
_oldFormat, 0, false));
if (_startByte != -1)
{
docInputStream = new
ByteRangeInputStream (docInputFile, _startByte, _endByte);
}
else
{
docInputStream = new FileInputStream
(docInputFile);
}
input = new XSLTInputSource (docInputStream);
styleInput = new ObjectInputStream (new FileInputStream
(styleFile));
stylesheet = (StylesheetRoot) styleInput.readObject ();
styleInput.close ();
output = new XSLTResultTarget (_newPath);
if (_newFormat.equals ("html"))
stylesheet.setOutputMethod ("html");
if (_newFormat.equals ("text"))
stylesheet.setOutputMethod ("text");
stylesheet.process (input, output);
converted = true;
}
return converted;
}
My ProblemListener is a trivial subclass of the ProblemListnerDefault.
It consists of a constructor taking no arguments that calls the
superclass constructor and a problem method that calls
System.err.println and then returns super.problem (...);
Any ideas?
Thanks for your time --Ben