diff --git a/CDL.java b/CDL.java index 5f907bf..1c7df32 100644 --- a/CDL.java +++ b/CDL.java @@ -224,7 +224,7 @@ public class CDL { */ public static JSONArray toJSONArray(JSONArray names, JSONTokener x) throws JSONException { - if (names == null || names.isEmpty()) { + if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); @@ -235,7 +235,7 @@ public class CDL { } ja.put(jo); } - if (ja.isEmpty()) { + if (ja.length() == 0) { return null; } return ja; @@ -272,7 +272,7 @@ public class CDL { */ public static String toString(JSONArray names, JSONArray ja) throws JSONException { - if (names == null || names.isEmpty()) { + if (names == null || names.length() == 0) { return null; } StringBuffer sb = new StringBuffer(); diff --git a/JSONML.java b/JSONML.java index f639050..acec7b8 100644 --- a/JSONML.java +++ b/JSONML.java @@ -178,7 +178,7 @@ public class JSONML { newjo.accumulate(attribute, ""); } } - if (arrayForm && !newjo.isEmpty()) { + if (arrayForm && newjo.length() > 0) { newja.put(newjo); } @@ -208,7 +208,7 @@ public class JSONML { "' and '" + closeTag + "'"); } tagName = null; - if (!arrayForm && !newja.isEmpty()) { + if (!arrayForm && newja.length() > 0) { newjo.put("childNodes", newja); } if (ja == null) { diff --git a/XML.java b/XML.java index f3eaa15..55362b2 100644 --- a/XML.java +++ b/XML.java @@ -277,7 +277,7 @@ public class XML { if ("CDATA".equals(token)) { if (x.next() == '[') { string = x.nextCDATA(); - if (!string.isEmpty()) { + if (string.length() > 0) { context.accumulate("content", string); } return false; @@ -353,7 +353,7 @@ public class XML { if (x.nextToken() != GT) { throw x.syntaxError("Misshaped tag"); } - if (!jsonobject.isEmpty()) { + if (jsonobject.length() > 0) { 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.isEmpty()) { + if (string.length() > 0) { 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.isEmpty()) { + if (jsonobject.length() == 0) { 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.isEmpty()) ? "<" + tagName + "/>" : "<" + tagName + : (string.length() == 0) ? "<" + tagName + "/>" : "<" + tagName + ">" + string + ""; }