use of org.springframework.xml.transform.StringResult in project spring-integration by spring-projects.
the class XmlTestUtil method docToString.
public static String docToString(Document doc) throws Exception {
DOMSource source = new DOMSource(doc);
StringResult stringResult = new StringResult();
transform(source, stringResult);
return stringResult.toString();
}
use of org.springframework.xml.transform.StringResult in project spring-integration by spring-projects.
the class XmlTestUtil method getStringResultForString.
public static StringResult getStringResultForString(String strDoc) throws Exception {
StringResult res = new StringResult();
transform(getDomSourceForString(strDoc), res);
return res;
}
use of org.springframework.xml.transform.StringResult in project spring-integration by spring-projects.
the class ResultToDocumentTransformerTests method testWithStringResult.
@Test
public void testWithStringResult() throws Exception {
StringResult result = XmlTestUtil.getStringResultForString(startDoc);
Object transformed = resToDocTransformer.transformResult(result);
assertTrue("Wrong transformed type expected Document", transformed instanceof Document);
Document doc = (Document) transformed;
assertEquals("Wrong root element name", "order", doc.getDocumentElement().getNodeName());
}
Aggregations