mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
partially revert changes
This commit is contained in:
parent
05074386d3
commit
7cad4c3b26
3 changed files with 10 additions and 10 deletions
6
CDL.java
6
CDL.java
|
@ -224,7 +224,7 @@ public class CDL {
|
||||||
*/
|
*/
|
||||||
public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
|
public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
|
||||||
throws JSONException {
|
throws JSONException {
|
||||||
if (names == null || names.isEmpty()) {
|
if (names == null || names.length() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
JSONArray ja = new JSONArray();
|
JSONArray ja = new JSONArray();
|
||||||
|
@ -235,7 +235,7 @@ public class CDL {
|
||||||
}
|
}
|
||||||
ja.put(jo);
|
ja.put(jo);
|
||||||
}
|
}
|
||||||
if (ja.isEmpty()) {
|
if (ja.length() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ja;
|
return ja;
|
||||||
|
@ -272,7 +272,7 @@ public class CDL {
|
||||||
*/
|
*/
|
||||||
public static String toString(JSONArray names, JSONArray ja)
|
public static String toString(JSONArray names, JSONArray ja)
|
||||||
throws JSONException {
|
throws JSONException {
|
||||||
if (names == null || names.isEmpty()) {
|
if (names == null || names.length() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class JSONML {
|
||||||
newjo.accumulate(attribute, "");
|
newjo.accumulate(attribute, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arrayForm && !newjo.isEmpty()) {
|
if (arrayForm && newjo.length() > 0) {
|
||||||
newja.put(newjo);
|
newja.put(newjo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public class JSONML {
|
||||||
"' and '" + closeTag + "'");
|
"' and '" + closeTag + "'");
|
||||||
}
|
}
|
||||||
tagName = null;
|
tagName = null;
|
||||||
if (!arrayForm && !newja.isEmpty()) {
|
if (!arrayForm && newja.length() > 0) {
|
||||||
newjo.put("childNodes", newja);
|
newjo.put("childNodes", newja);
|
||||||
}
|
}
|
||||||
if (ja == null) {
|
if (ja == null) {
|
||||||
|
|
10
XML.java
10
XML.java
|
@ -277,7 +277,7 @@ public class XML {
|
||||||
if ("CDATA".equals(token)) {
|
if ("CDATA".equals(token)) {
|
||||||
if (x.next() == '[') {
|
if (x.next() == '[') {
|
||||||
string = x.nextCDATA();
|
string = x.nextCDATA();
|
||||||
if (!string.isEmpty()) {
|
if (string.length() > 0) {
|
||||||
context.accumulate("content", string);
|
context.accumulate("content", string);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -353,7 +353,7 @@ public class XML {
|
||||||
if (x.nextToken() != GT) {
|
if (x.nextToken() != GT) {
|
||||||
throw x.syntaxError("Misshaped tag");
|
throw x.syntaxError("Misshaped tag");
|
||||||
}
|
}
|
||||||
if (!jsonobject.isEmpty()) {
|
if (jsonobject.length() > 0) {
|
||||||
context.accumulate(tagName, jsonobject);
|
context.accumulate(tagName, jsonobject);
|
||||||
} else {
|
} else {
|
||||||
context.accumulate(tagName, "");
|
context.accumulate(tagName, "");
|
||||||
|
@ -371,7 +371,7 @@ public class XML {
|
||||||
return false;
|
return false;
|
||||||
} else if (token instanceof String) {
|
} else if (token instanceof String) {
|
||||||
string = (String) token;
|
string = (String) token;
|
||||||
if (!string.isEmpty()) {
|
if (string.length() > 0) {
|
||||||
jsonobject.accumulate("content",
|
jsonobject.accumulate("content",
|
||||||
keepStrings ? string : stringToValue(string));
|
keepStrings ? string : stringToValue(string));
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ public class XML {
|
||||||
} else if (token == LT) {
|
} else if (token == LT) {
|
||||||
// Nested element
|
// Nested element
|
||||||
if (parse(x, jsonobject, tagName,keepStrings)) {
|
if (parse(x, jsonobject, tagName,keepStrings)) {
|
||||||
if (jsonobject.isEmpty()) {
|
if (jsonobject.length() == 0) {
|
||||||
context.accumulate(tagName, "");
|
context.accumulate(tagName, "");
|
||||||
} else if (jsonobject.length() == 1
|
} else if (jsonobject.length() == 1
|
||||||
&& jsonobject.opt("content") != null) {
|
&& jsonobject.opt("content") != null) {
|
||||||
|
@ -676,7 +676,7 @@ public class XML {
|
||||||
|
|
||||||
string = (object == null) ? "null" : escape(object.toString());
|
string = (object == null) ? "null" : escape(object.toString());
|
||||||
return (tagName == null) ? "\"" + string + "\""
|
return (tagName == null) ? "\"" + string + "\""
|
||||||
: (string.isEmpty()) ? "<" + tagName + "/>" : "<" + tagName
|
: (string.length() == 0) ? "<" + tagName + "/>" : "<" + tagName
|
||||||
+ ">" + string + "</" + tagName + ">";
|
+ ">" + string + "</" + tagName + ">";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue