Skip to content

Commit e430db4

Browse files
author
Keaton Taylor
committed
Update XMLParserConfiguration to not be static and add a comment about the use of shouldTrimWhiteSpace
1 parent 9ee10fd commit e430db4

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/main/java/org/json/XMLParserConfiguration.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ public class XMLParserConfiguration extends ParserConfiguration {
6161
*/
6262
private Set<String> forceList;
6363

64+
65+
/**
66+
* Flag to indicate whether white space should be trimmed when parsing XML.
67+
* The default behaviour is to trim white space. When this is set to false, inputting XML
68+
* with tags that are the same as the value of cDataTagName is unsupported. It is recommended to set cDataTagName
69+
* to a distinct value in this case.
70+
*/
6471
private boolean shouldTrimWhiteSpace;
6572

6673
/**

src/main/java/org/json/XMLTokener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class XMLTokener extends JSONTokener {
2020
*/
2121
public static final java.util.HashMap<String, Character> entity;
2222

23-
private static XMLParserConfiguration configuration = XMLParserConfiguration.ORIGINAL;;
23+
private XMLParserConfiguration configuration = XMLParserConfiguration.ORIGINAL;;
2424

2525
static {
2626
entity = new java.util.HashMap<String, Character>(8);
@@ -49,11 +49,11 @@ public XMLTokener(String s) {
4949

5050
public XMLTokener(Reader r, XMLParserConfiguration configuration) {
5151
super(r);
52-
XMLTokener.configuration = configuration;
52+
this.configuration = configuration;
5353
}
5454
public XMLTokener(String s, XMLParserConfiguration configuration) {
5555
super(s);
56-
XMLTokener.configuration = configuration;
56+
this.configuration = configuration;
5757
}
5858

5959
/**

0 commit comments

Comments
 (0)