K
killy971
I am using the following syntax, with Xalan, to process xml
transformations in java:
StreamSource xml = new StreamSource(xmlFile);
StreamSource xsl = new StreamSource(xslFile);
StreamResult out = new StreamResult(outputFile);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(xsl);
transformer.transform(xml, out);
If the xslt sheet input is broken (invalid xml, etc.), an exception is
thrown (fatal error occurs), but if the input xml file (file to
transform) is broken no exception is thrown (because it is not a fatal
error).
I would like to knwo if there is a way to make the transformer throw
an exception on this kind of errors, or if there is a way to check if
an error has occured after the "transform()" call.
transformations in java:
StreamSource xml = new StreamSource(xmlFile);
StreamSource xsl = new StreamSource(xslFile);
StreamResult out = new StreamResult(outputFile);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(xsl);
transformer.transform(xml, out);
If the xslt sheet input is broken (invalid xml, etc.), an exception is
thrown (fatal error occurs), but if the input xml file (file to
transform) is broken no exception is thrown (because it is not a fatal
error).
I would like to knwo if there is a way to make the transformer throw
an exception on this kind of errors, or if there is a way to check if
an error has occured after the "transform()" call.