mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
refactor: introduce explaining variable 'indentationSuffix' in XML.toString()
This commit is contained in:
parent
097a401f3f
commit
75419e3f25
@ -847,14 +847,14 @@ public class XML {
|
|||||||
|
|
||||||
|
|
||||||
string = (object == null) ? "null" : escape(object.toString());
|
string = (object == null) ? "null" : escape(object.toString());
|
||||||
|
String indentationSuffix = (indentFactor > 0) ? "\n" : "";
|
||||||
if(tagName == null){
|
if(tagName == null){
|
||||||
return indent(indent) + "\"" + string + "\"" + ((indentFactor > 0) ? "\n" : "");
|
return indent(indent) + "\"" + string + "\"" + indentationSuffix;
|
||||||
} else if(string.length() == 0){
|
} else if(string.length() == 0){
|
||||||
return indent(indent) + "<" + tagName + "/>" + ((indentFactor > 0) ? "\n" : "");
|
return indent(indent) + "<" + tagName + "/>" + indentationSuffix;
|
||||||
} else {
|
} else {
|
||||||
return indent(indent) + "<" + tagName
|
return indent(indent) + "<" + tagName
|
||||||
+ ">" + string + "</" + tagName + ">" + ((indentFactor > 0) ? "\n" : "");
|
+ ">" + string + "</" + tagName + ">" + indentationSuffix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user