use of php.runtime.ext.java.JavaException in project jphp by jphp-compiler.
the class WrapXmlProcessor method __construct.
@Signature
public void __construct(final Environment env) throws ParserConfigurationException, TransformerConfigurationException {
transformerFactory = TransformerFactory.newInstance();
transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
builderFactory = DocumentBuilderFactory.newInstance();
builder = builderFactory.newDocumentBuilder();
builder.setErrorHandler(new ErrorHandler() {
@Override
public void warning(SAXParseException exception) throws SAXException {
if (onWarning != null) {
onWarning.callAny(new JavaException(env, exception));
}
}
@Override
public void error(SAXParseException exception) throws SAXException {
if (onError != null) {
onError.callAny(new JavaException(env, exception));
}
}
@Override
public void fatalError(SAXParseException exception) throws SAXException {
if (onFatalError != null) {
onFatalError.callAny(new JavaException(env, exception));
} else {
throw exception;
}
}
});
}
Aggregations