mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
change length comparison to isEmpty method
This commit is contained in:
parent
a490ebdb78
commit
05074386d3
5 changed files with 25 additions and 25 deletions
10
XML.java
10
XML.java
|
@ -277,7 +277,7 @@ public class XML {
|
|||
if ("CDATA".equals(token)) {
|
||||
if (x.next() == '[') {
|
||||
string = x.nextCDATA();
|
||||
if (string.length() > 0) {
|
||||
if (!string.isEmpty()) {
|
||||
context.accumulate("content", string);
|
||||
}
|
||||
return false;
|
||||
|
@ -353,7 +353,7 @@ public class XML {
|
|||
if (x.nextToken() != GT) {
|
||||
throw x.syntaxError("Misshaped tag");
|
||||
}
|
||||
if (jsonobject.length() > 0) {
|
||||
if (!jsonobject.isEmpty()) {
|
||||
context.accumulate(tagName, jsonobject);
|
||||
} else {
|
||||
context.accumulate(tagName, "");
|
||||
|
@ -371,7 +371,7 @@ public class XML {
|
|||
return false;
|
||||
} else if (token instanceof String) {
|
||||
string = (String) token;
|
||||
if (string.length() > 0) {
|
||||
if (!string.isEmpty()) {
|
||||
jsonobject.accumulate("content",
|
||||
keepStrings ? string : stringToValue(string));
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ public class XML {
|
|||
} else if (token == LT) {
|
||||
// Nested element
|
||||
if (parse(x, jsonobject, tagName,keepStrings)) {
|
||||
if (jsonobject.length() == 0) {
|
||||
if (jsonobject.isEmpty()) {
|
||||
context.accumulate(tagName, "");
|
||||
} else if (jsonobject.length() == 1
|
||||
&& jsonobject.opt("content") != null) {
|
||||
|
@ -676,7 +676,7 @@ public class XML {
|
|||
|
||||
string = (object == null) ? "null" : escape(object.toString());
|
||||
return (tagName == null) ? "\"" + string + "\""
|
||||
: (string.length() == 0) ? "<" + tagName + "/>" : "<" + tagName
|
||||
: (string.isEmpty()) ? "<" + tagName + "/>" : "<" + tagName
|
||||
+ ">" + string + "</" + tagName + ">";
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue