use of com.adaptris.util.text.xml.XmlTransformerFactory in project interlok by adaptris.
the class XmlTransformerTest method testTransform_InputStreamOutputStream.
@Test
public void testTransform_InputStreamOutputStream() throws Exception {
XmlTransformerFactory factory = new XsltTransformerFactory();
XmlTransformer transform = factory.configure(new XmlTransformer());
String xsl = backslashToSlash(PROPERTIES.getProperty(KEY_XML_TEST_TRANSFORM_URL));
AdaptrisMessage m1 = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
try (InputStream in = m1.getInputStream();
OutputStream out = m1.getOutputStream()) {
transform.transform(factory.createTransformer(xsl), in, out, xsl);
}
}
use of com.adaptris.util.text.xml.XmlTransformerFactory in project interlok by adaptris.
the class XmlTransformerTest method testTransform_ReaderWriter.
@Test
public void testTransform_ReaderWriter() throws Exception {
XmlTransformerFactory factory = new XsltTransformerFactory();
XmlTransformer transform = new XmlTransformer();
String xsl = backslashToSlash(PROPERTIES.getProperty(KEY_XML_TEST_TRANSFORM_URL));
AdaptrisMessage m1 = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
try (Reader in = m1.getReader();
Writer out = m1.getWriter()) {
transform.transform(factory.createTransformer(xsl), in, out, xsl);
}
}
use of com.adaptris.util.text.xml.XmlTransformerFactory in project interlok by adaptris.
the class XmlTransformerTest method testTransform.
@Test
public void testTransform() throws Exception {
XmlTransformerFactory factory = new XsltTransformerFactory();
XmlTransformer transform = factory.configure(new XmlTransformer());
transform.registerBuilder(DocumentBuilderFactoryBuilder.newInstance());
String xsl = backslashToSlash(PROPERTIES.getProperty(KEY_XML_TEST_TRANSFORM_URL));
AdaptrisMessage m1 = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
try (InputStream in = m1.getInputStream();
OutputStream out = m1.getOutputStream()) {
StreamResult output = new StreamResult(out);
StreamSource input = new StreamSource(in);
transform.transform(factory.createTransformer(xsl), input, output, xsl, new HashMap<>(System.getProperties()));
}
AdaptrisMessage m2 = MessageHelper.createMessage(PROPERTIES.getProperty(KEY_XML_TEST_INPUT));
try (InputStream in = m2.getInputStream();
OutputStream out = m2.getOutputStream()) {
StreamResult output = new StreamResult(out);
StreamSource input = new StreamSource(in);
transform.transform(factory.createTransformer(xsl), input, output, xsl);
}
}
Aggregations