diff --git a/src/main/java/org/json/XML.java b/src/main/java/org/json/XML.java index 04c8bcd..a94c3fc 100644 --- a/src/main/java/org/json/XML.java +++ b/src/main/java/org/json/XML.java @@ -847,14 +847,14 @@ public class XML { string = (object == null) ? "null" : escape(object.toString()); - + String indentationSuffix = (indentFactor > 0) ? "\n" : ""; if(tagName == null){ - return indent(indent) + "\"" + string + "\"" + ((indentFactor > 0) ? "\n" : ""); + return indent(indent) + "\"" + string + "\"" + indentationSuffix; } else if(string.length() == 0){ - return indent(indent) + "<" + tagName + "/>" + ((indentFactor > 0) ? "\n" : ""); + return indent(indent) + "<" + tagName + "/>" + indentationSuffix; } else { return indent(indent) + "<" + tagName - + ">" + string + "" + ((indentFactor > 0) ? "\n" : ""); + + ">" + string + "" + indentationSuffix; } }