Passed simple test

This commit is contained in:
Zach 2021-11-19 20:46:15 -06:00
parent fafaeb7aa6
commit a0f90b776d

View File

@ -413,6 +413,16 @@ public class XML {
} else if (token == LT) { } else if (token == LT) {
// Nested element // Nested element
if (parse(x, jsonObject, tagName, config)) { if (parse(x, jsonObject, tagName, config)) {
if (config.getForceList().contains(tagName)) {
if (jsonObject.length() == 0) {
context.append(tagName, "");
} else if (jsonObject.length() == 1
&& jsonObject.opt(config.getcDataTagName()) != null) {
context.append(tagName, jsonObject.opt(config.getcDataTagName()));
} else {
context.append(tagName, jsonObject);
}
} else {
if (jsonObject.length() == 0) { if (jsonObject.length() == 0) {
context.accumulate(tagName, ""); context.accumulate(tagName, "");
} else if (jsonObject.length() == 1 } else if (jsonObject.length() == 1
@ -421,6 +431,8 @@ public class XML {
} else { } else {
context.accumulate(tagName, jsonObject); context.accumulate(tagName, jsonObject);
} }
}
return false; return false;
} }
} }