#790 - Update XML with changes for string to number conversion.

For now the code remains duplicated in JSON and XML parsers.
Unit test cases updated to comply with number expectations.
This commit is contained in:
rudrajyoti biswas
2023-10-19 14:07:53 +05:30
parent 1d0775cce7
commit 2374766018
4 changed files with 54 additions and 12 deletions

View File

@@ -733,7 +733,7 @@ public class XMLConfigurationTest {
@Test
public void testToJSONArray_jsonOutput() {
final String originalXml = "<root><id>01</id><id>1</id><id>00</id><id>0</id><item id=\"01\"/><title>True</title></root>";
final JSONObject expected = new JSONObject("{\"root\":{\"item\":{\"id\":\"01\"},\"id\":[\"01\",1,\"00\",0],\"title\":true}}");
final JSONObject expected = new JSONObject("{\"root\":{\"item\":{\"id\":1},\"id\":[1,1,0,0],\"title\":true}}");
final JSONObject actualJsonOutput = XML.toJSONObject(originalXml,
new XMLParserConfiguration().withKeepStrings(false));
Util.compareActualVsExpectedJsonObjects(actualJsonOutput,expected);