Search in sources :

Example 1 with XmlAligner

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;
}
Also used : PipeRunResult(nl.nn.adapterframework.core.PipeRunResult) XmlAligner(nl.nn.adapterframework.align.XmlAligner) Xml2Json(nl.nn.adapterframework.align.Xml2Json) PipeForward(nl.nn.adapterframework.core.PipeForward) XMLReader(org.xml.sax.XMLReader) ValidationContext(nl.nn.adapterframework.validation.ValidationContext)

Aggregations

Xml2Json (nl.nn.adapterframework.align.Xml2Json)1 XmlAligner (nl.nn.adapterframework.align.XmlAligner)1 PipeForward (nl.nn.adapterframework.core.PipeForward)1 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)1 ValidationContext (nl.nn.adapterframework.validation.ValidationContext)1 XMLReader (org.xml.sax.XMLReader)1