File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
main/java/org/springframework/ws/pox/dom
test/java/org/springframework/ws/pox/dom Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 26
26
import javax .xml .transform .dom .DOMSource ;
27
27
import javax .xml .transform .stream .StreamResult ;
28
28
29
+ import org .w3c .dom .Document ;
30
+ import org .w3c .dom .Element ;
31
+ import org .w3c .dom .NodeList ;
32
+
29
33
import org .springframework .util .Assert ;
30
34
import org .springframework .ws .pox .PoxMessage ;
31
35
import org .springframework .ws .transport .TransportConstants ;
32
36
import org .springframework .ws .transport .TransportOutputStream ;
33
37
import org .springframework .xml .namespace .QNameUtils ;
34
- import org .w3c .dom .Document ;
35
- import org .w3c .dom .Element ;
36
38
37
39
/**
38
40
* Implementation of the <code>PoxMessage</code> interface that is based on a DOM Document.
@@ -69,6 +71,10 @@ public Document getDocument() {
69
71
}
70
72
71
73
public Result getPayloadResult () {
74
+ NodeList children = document .getChildNodes ();
75
+ for (int i = 0 ; i < children .getLength (); i ++) {
76
+ document .removeChild (children .item (i ));
77
+ }
72
78
return new DOMResult (document );
73
79
}
74
80
Original file line number Diff line number Diff line change 23
23
import javax .xml .transform .TransformerFactory ;
24
24
25
25
import org .custommonkey .xmlunit .XMLTestCase ;
26
+ import org .w3c .dom .Document ;
27
+
26
28
import org .springframework .xml .transform .StringResult ;
27
29
import org .springframework .xml .transform .StringSource ;
28
- import org .w3c .dom .Document ;
29
30
30
31
public class DomPoxMessageTest extends XMLTestCase {
31
32
@@ -53,6 +54,15 @@ public void testGetPayload() throws Exception {
53
54
assertXMLEqual (content , stringResult .toString ());
54
55
}
55
56
57
+ public void testGetPayloadResultTwice () throws Exception {
58
+ String content = "<element xmlns=\" http://www.springframework.org/spring-ws\" />" ;
59
+ transformer .transform (new StringSource (content ), message .getPayloadResult ());
60
+ transformer .transform (new StringSource (content ), message .getPayloadResult ());
61
+ StringResult stringResult = new StringResult ();
62
+ transformer .transform (message .getPayloadSource (), stringResult );
63
+ assertXMLEqual (content , stringResult .toString ());
64
+ }
65
+
56
66
public void testWriteTo () throws Exception {
57
67
String content = "<root xmlns='http://www.springframework.org/spring-ws'>" + "<child/></root>" ;
58
68
StringSource source = new StringSource (content );
You can’t perform that action at this time.
0 commit comments