I have a piece of code, that converts an XML file and an XSLT file to HTML. I'm trying to test each case in the ErrorListener(fatal error, error and warning), but I can't find any documentation on what causes any of them.
I have tried making intentional errors in my documents, but i only get [Fatal Error].
The code I have, uses the same ErrorListener in TransfomerFactory and in Transformer.
private String convertXmlToHtml(Source xml, Source xslt) throws TransformerException {
StringWriter sw = new StringWriter();
TransformerFactory tFactory = TransformerFactory.newInstance();
ErrorListenerThrowOnFatal errorListener = new ErrorListenerThrowOnFatal();
tFactory.setErrorListener(errorListener);
Transformer transform = tFactory.newTransformer(xslt);
transform.setErrorListener(errorListener);
transform.transform(xml, new StreamResult(sw));
return sw.toString();
}
What are specific scenarios when an error/warning is not fatal?
EDIT: The scenarios should be of errors/warnings in the input files. e.i. When will TransformerFactory.newTransformer() or Transformer.transform() create an error/warning.