use of org.codehaus.stax2.XMLStreamWriter2 in project cxf by apache.
the class Stax2ValidationUtils method setupValidation.
public boolean setupValidation(XMLStreamWriter writer, Endpoint endpoint, ServiceInfo serviceInfo) throws XMLStreamException {
XMLStreamWriter2 writer2 = (XMLStreamWriter2) writer;
XMLValidationSchema vs = getValidator(endpoint, serviceInfo);
if (vs == null) {
return false;
}
writer2.setValidationProblemHandler(new ValidationProblemHandler() {
public void reportProblem(XMLValidationProblem problem) throws XMLValidationException {
throw new Fault(problem.getMessage(), LOG);
}
});
writer2.validateAgainst(vs);
return true;
}
Aggregations