Search in sources :

Example 1 with XmlJsonWriter

use of nl.nn.adapterframework.util.XmlJsonWriter in project iaf by ibissource.

the class JsonXsltSender method createHandler.

@Override
protected ContentHandler createHandler(Message input, ThreadConnector threadConnector, PipeLineSession session, MessageOutputStream target) throws StreamingException {
    if (!isJsonResult()) {
        return super.createHandler(input, threadConnector, session, target);
    }
    XmlJsonWriter xjw = new XmlJsonWriter(target.asWriter());
    MessageOutputStream prev = new MessageOutputStream(this, xjw, target, threadLifeCycleEventListener, txManager, session, null);
    ContentHandler handler = super.createHandler(input, threadConnector, session, prev);
    if (getXmlDebugger() != null) {
        handler = getXmlDebugger().inspectXml(session, "XML to be converted to JSON", handler);
    }
    return handler;
}
Also used : MessageOutputStream(nl.nn.adapterframework.stream.MessageOutputStream) XmlJsonWriter(nl.nn.adapterframework.util.XmlJsonWriter) ContentHandler(org.xml.sax.ContentHandler)

Example 2 with XmlJsonWriter

use of nl.nn.adapterframework.util.XmlJsonWriter in project iaf by ibissource.

the class JsonXsltPipe method transform.

@Override
protected String transform(TransformerPool tp, Source source, Map parametervalues) throws TransformerException, IOException {
    SAXResult result = new SAXResult();
    XmlJsonWriter xjw = new XmlJsonWriter();
    result.setHandler(xjw);
    tp.transform(source, result, parametervalues);
    return xjw.toString();
}
Also used : SAXResult(javax.xml.transform.sax.SAXResult) XmlJsonWriter(nl.nn.adapterframework.util.XmlJsonWriter)

Aggregations

XmlJsonWriter (nl.nn.adapterframework.util.XmlJsonWriter)2 SAXResult (javax.xml.transform.sax.SAXResult)1 MessageOutputStream (nl.nn.adapterframework.stream.MessageOutputStream)1 ContentHandler (org.xml.sax.ContentHandler)1