mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-08 03:24:27 +08:00
#748 - close XML tag explicitly for empty tags with configuration.
This commit is contained in:
@@ -557,6 +557,17 @@ public class XMLConfigurationTest {
|
||||
assertEquals(actualXML, resultXML);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHandleEmptyNodeValue()
|
||||
{
|
||||
JSONObject inputJSON = new JSONObject();
|
||||
inputJSON.put("Emptyness", "");
|
||||
String expectedXmlWithoutExplicitEndTag = "<Emptyness/>";
|
||||
String expectedXmlWithExplicitEndTag = "<Emptyness></Emptyness>";
|
||||
assertEquals(expectedXmlWithoutExplicitEndTag, XML.toString(inputJSON, null, new XMLParserConfiguration().withCloseEmptyTag(false)));
|
||||
assertEquals(expectedXmlWithExplicitEndTag, XML.toString(inputJSON, null, new XMLParserConfiguration().withCloseEmptyTag(true)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Investigate exactly how the "content" keyword works
|
||||
*/
|
||||
|
Reference in New Issue
Block a user