File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
main/java/org/metafacture/xml
test/java/org/metafacture/xml Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 53
53
public final class SimpleXmlEncoder extends DefaultStreamPipe <ObjectReceiver <String >> {
54
54
55
55
public static final String ATTRIBUTE_MARKER = "~" ;
56
+ public static final String DEFAULT_VALUE_TAG = "" ;
56
57
57
58
private static final String NEW_LINE = "\n " ;
58
59
private static final String INDENT = "\t " ;
@@ -73,7 +74,7 @@ public final class SimpleXmlEncoder extends DefaultStreamPipe<ObjectReceiver<Str
73
74
private String attributeMarker = ATTRIBUTE_MARKER ;
74
75
private String rootTag = DefaultXmlPipe .DEFAULT_ROOT_TAG ;
75
76
private String recordTag = DefaultXmlPipe .DEFAULT_RECORD_TAG ;
76
- private String valueTag = DefaultXmlPipe . DEFAULT_VALUE_TAG ;
77
+ private String valueTag = DEFAULT_VALUE_TAG ;
77
78
private Map <String , String > namespaces = new HashMap <String , String >();
78
79
private boolean writeRootTag = true ;
79
80
private boolean writeXmlHeader = true ;
Original file line number Diff line number Diff line change 19
19
import static org .junit .Assert .assertEquals ;
20
20
import static org .junit .Assert .assertTrue ;
21
21
22
+ import org .metafacture .framework .helpers .DefaultObjectReceiver ;
23
+ import org .metafacture .framework .helpers .DefaultXmlPipe ;
24
+
22
25
import java .util .HashMap ;
23
26
import java .util .Map ;
24
27
25
28
import org .junit .Before ;
26
29
import org .junit .Test ;
27
- import org .metafacture .framework .helpers .DefaultObjectReceiver ;
28
30
29
31
/**
30
32
* Tests for class {@link SimpleXmlEncoder}.
@@ -251,6 +253,22 @@ public void issue379_testShouldEncodeConfiguredValueLiteralsAsText() {
251
253
getResultXml ());
252
254
}
253
255
256
+ @ Test
257
+ public void issue379_testShouldNotEncodeUnconfiguredValueLiteralsAsText () {
258
+ simpleXmlEncoder .startRecord ("" );
259
+ simpleXmlEncoder .literal (DefaultXmlPipe .DEFAULT_VALUE_TAG , VALUE );
260
+ simpleXmlEncoder .endRecord ();
261
+ simpleXmlEncoder .closeStream ();
262
+
263
+ assertEquals ("<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>" +
264
+ "<records>" +
265
+ "<record>" +
266
+ "<value>value</value>" +
267
+ "</record>" +
268
+ "</records>" ,
269
+ getResultXml ());
270
+ }
271
+
254
272
@ Test
255
273
public void testShouldEncodeMarkedLiteralsAsAttributes () {
256
274
simpleXmlEncoder .startRecord ("" );
You can’t perform that action at this time.
0 commit comments