// Only DOMSource and SAXSource are allowed for validating
// See http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/Validator.html#validate(javax.xml.transform.Source,%20javax.xml.transform.Result)
// As we expect a DOMResult as output, we must ensure that the input is a
// DOMSource
Source src = new SourceTransformer().toDOMSource(out.getContent());
validator.validate(src, result);
if (errorHandler.hasErrors()) {
Fault fault = exchange.createFault();
fault.setProperty("org.servicemix.schema", schema);
fault.setContent(new DOMSource(result.getNode(), result.getSystemId()));
throw new FaultException("Failed to validate against schema: " + schema, exchange, fault);