Skip to content

Commit 9209745

Browse files
committed
change how indent, returns work with xml formatting
1 parent 5684907 commit 9209745

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

core/src/processing/data/XML.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class XML implements Serializable {
6363

6464
/**
6565
* @nowebref
66-
*/
66+
*/
6767
protected XML() { }
6868

6969

@@ -1007,11 +1007,13 @@ public String format(int indent) {
10071007
return singleLine;
10081008
}
10091009

1010-
// Might just be whitespace, which won't be valid XML. And in that case,
1011-
// even adding the decl to the top seems dumb, so don't spew out a decl.
1010+
// Might just be whitespace, which won't be valid XML for parsing below.
10121011
// https://github.com/processing/processing/issues/1796
1012+
// Since indent is not -1, that means they want valid XML,
1013+
// so we'll give them the single line plus the decl.
10131014
if (singleLine.trim().length() == 0) {
1014-
return "";
1015+
// You want whitespace? I've got your whitespace right here.
1016+
return singleLine;
10151017
}
10161018

10171019
// Since the indent is not -1, bring back the XML declaration
@@ -1049,6 +1051,7 @@ public String format(int indent) {
10491051
*/
10501052
@Override
10511053
public String toString() {
1052-
return format(2);
1054+
//return format(2);
1055+
return format(-1);
10531056
}
10541057
}

0 commit comments

Comments
 (0)