fault.setContent(
sourceTransformer.toDOMSource(
new StringSource(
(String)errorHandler.getMessagesAs(String.class))));
} else {
throw new MessagingException("MessageAwareErrorHandler implementation " +
errorHandler.getClass().getName() +
" does not support a compatible error message format.");
}
} else {
/*
* we can't do much here if the ErrorHandler implementation does
* not support capturing messages
*/
fault.setContent(new DOMSource(result.getNode(), result.getSystemId()));
}
throw new FaultException("Failed to validate against schema: " + schema, exchange, fault);
}
else {
// Retrieve the ouput of the validation
// as it may have been changed by the validator
out.setContent(new DOMSource(result.getNode(), result.getSystemId()));
return true;
}
}
catch (SAXException e) {
throw new MessagingException(e);
}
catch (IOException e) {
throw new MessagingException(e);
}
catch (ParserConfigurationException e) {
throw new MessagingException(e);
}
catch (TransformerException e) {
throw new MessagingException(e);
}
}