use of nl.nn.adapterframework.align.XmlAligner in project iaf by ibissource.
the class Json2XmlValidator method alignXml2Json.
protected PipeRunResult alignXml2Json(String messageToValidate, IPipeLineSession session, boolean responseMode) throws XmlValidatorException, PipeRunException, ConfigurationException {
ValidationContext context = validator.createValidationContext(session, getRootValidations(responseMode), getInvalidRootNamespaces());
XMLReader parser = validator.getValidatingParser(session, context);
XmlAligner aligner = new XmlAligner((PSVIProvider) parser);
Xml2Json xml2json = new Xml2Json(aligner, isCompactJsonArrays(), !isJsonWithRootElements());
parser.setContentHandler(aligner);
aligner.setContentHandler(xml2json);
aligner.setErrorHandler(context.getErrorHandler());
String resultEvent = validator.validate(messageToValidate, session, getLogPrefix(session), parser, xml2json, context);
String out = xml2json.toString();
PipeForward forward = determineForward(resultEvent, session, responseMode);
PipeRunResult result = new PipeRunResult(forward, out);
return result;
}
Aggregations