Search in sources :

Example 16 with StringResult

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();
}
Also used : DOMSource(javax.xml.transform.dom.DOMSource) StringResult(org.springframework.xml.transform.StringResult)

Example 17 with StringResult

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;
}
Also used : StringResult(org.springframework.xml.transform.StringResult)

Example 18 with StringResult

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());
}
Also used : StringResult(org.springframework.xml.transform.StringResult) Document(org.w3c.dom.Document) Test(org.junit.Test)

Aggregations

StringResult (org.springframework.xml.transform.StringResult)18 Transformer (javax.xml.transform.Transformer)8 DOMSource (javax.xml.transform.dom.DOMSource)7 Test (org.junit.Test)7 StringSource (org.springframework.xml.transform.StringSource)4 Document (org.w3c.dom.Document)3 Result (javax.xml.transform.Result)2 Source (javax.xml.transform.Source)2 TransformerFactory (javax.xml.transform.TransformerFactory)2 DOMResult (javax.xml.transform.dom.DOMResult)2 BeanFactory (org.springframework.beans.factory.BeanFactory)2 StubStringResult (org.springframework.integration.xml.config.StubResultFactory.StubStringResult)2 MessageChannel (org.springframework.messaging.MessageChannel)2 MessageHandlingException (org.springframework.messaging.MessageHandlingException)2 GenericMessage (org.springframework.messaging.support.GenericMessage)2 SettableListenableFuture (org.springframework.util.concurrent.SettableListenableFuture)2 WebServiceMessage (org.springframework.ws.WebServiceMessage)2 ClientInterceptorAdapter (org.springframework.ws.client.support.interceptor.ClientInterceptorAdapter)2 MessageContext (org.springframework.ws.context.MessageContext)2 IOException (java.io.IOException)1