use of org.apache.camel.component.schematron.exception.SchematronValidationException in project camel by apache.
the class SchematronProcessor method validate.
/**
* Validates the given XML for given Rules.
*
* @param xml
* @return
*/
public String validate(final String xml) {
try {
final Source source = new SAXSource(reader, new InputSource(IOUtils.toInputStream(xml)));
final StringWriter writer = new StringWriter();
templates.newTransformer().transform(source, new StreamResult(writer));
return writer.toString();
} catch (TransformerException e) {
logger.error(e.getMessage());
throw new SchematronValidationException("Failed to apply Schematron validation transform", e);
}
}
Aggregations