diff --git a/XML.java b/XML.java index 23a991906..01f58e5d5 100755 --- a/XML.java +++ b/XML.java @@ -120,6 +120,9 @@ public static void noSpace(String string) throws JSONException { /** * Scan the content following the named tag, attaching it to the context. + * + * It does NOT generate an empty string JSON value for an empty XML tag. + * * @param x The XMLTokener containing the source string. * @param context The JSONObject that will include the new material. * @param name The tag name. @@ -243,9 +246,11 @@ private static boolean parse(XMLTokener x, JSONObject context, } if (jsonobject.length() > 0) { context.accumulate(tagName, jsonobject); - } else { - context.accumulate(tagName, ""); } + // We do not want to consider empty tags + // else { + // context.accumulate(tagName, ""); + // } return false; // Content, between <...> and @@ -473,7 +478,7 @@ public static String toString(Object object, String tagName) if (object.getClass().isArray()) { object = new JSONArray(object); } - + if (object instanceof JSONArray) { ja = (JSONArray)object; length = ja.length(); @@ -487,6 +492,6 @@ public static String toString(Object object, String tagName) return (tagName == null) ? "\"" + string + "\"" : (string.length() == 0) ? "<" + tagName + "/>" : "<" + tagName + ">" + string + ""; - + } }