use of org.milyn.payload.StringResult in project tutorials by eugenp.
the class OrderValidator method validate.
public ValidationResult validate(String path) throws IOException, SAXException {
Smooks smooks = new Smooks(OrderValidator.class.getResourceAsStream("/smooks/smooks-validation.xml"));
try {
StringResult xmlResult = new StringResult();
JavaResult javaResult = new JavaResult();
ValidationResult validationResult = new ValidationResult();
smooks.filterSource(new StreamSource(OrderValidator.class.getResourceAsStream(path)), xmlResult, javaResult, validationResult);
return validationResult;
} finally {
smooks.close();
}
}
use of org.milyn.payload.StringResult in project tutorials by eugenp.
the class OrderConverter method convertDocumentWithTempalte.
private String convertDocumentWithTempalte(String path, String config) throws IOException, SAXException {
Smooks smooks = new Smooks(config);
try {
StringResult stringResult = new StringResult();
smooks.filterSource(new StreamSource(OrderConverter.class.getResourceAsStream(path)), stringResult);
return stringResult.toString();
} finally {
smooks.close();
}
}
Aggregations