use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class DocumentBuilderTest method testXmlDocumentBuilder.
@Test
public void testXmlDocumentBuilder() throws SAXException {
String expected = expectedXml;
XmlWriter writer = new XmlWriter();
try (IDocumentBuilder root = new XmlDocumentBuilder("root", writer)) {
buildDocument(root);
}
MatchUtils.assertXmlEquals(expected, writer.toString());
assertEquals(expected, writer.toString());
}
use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class XmlWriterTest method testToWriter.
@Test
public void testToWriter() throws Exception {
StringWriter target = new StringWriter();
XmlWriter xmlWriter = new XmlWriter(target);
sendEvents(xmlWriter);
String actual = new String(target.toString());
assertEquals(testString, actual);
}
use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class MessageTest method testAsInputSource.
protected void testAsInputSource(Message adapter) throws IOException, SAXException {
InputSource result = adapter.asInputSource();
XmlWriter sink = new XmlWriter();
XmlUtils.parseXml(result, sink);
String actual = sink.toString();
MatchUtils.assertXmlEquals(testString, actual);
}
use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class ToXml method translate.
public String translate(C data) throws SAXException {
XmlWriter xmlWriter = new XmlWriter();
setContentHandler(xmlWriter);
startParse(data);
return xmlWriter.toString();
}
use of nl.nn.adapterframework.xml.XmlWriter in project iaf by ibissource.
the class DB2XMLWriter method getXML.
public String getXML(IDbmsSupport dbmsSupport, ResultSet rs, int maxlength, boolean includeFieldDefinition) {
try {
XmlWriter xmlWriter = new XmlWriter();
PrettyPrintFilter ppf = new PrettyPrintFilter(xmlWriter);
getXML(dbmsSupport, rs, maxlength, includeFieldDefinition, ppf);
return xmlWriter.toString();
} catch (SAXException e) {
log.warn("cannot convert ResultSet to XML", e);
return "<error>" + XmlUtils.encodeCharsAndReplaceNonValidXmlCharacters(e.getMessage()) + "</error>";
}
}
Aggregations