Update XMLParserConfiguration to not be static and add a comment about the use of shouldTrimWhiteSpace

This commit is contained in:
Keaton Taylor 2023-11-30 10:05:08 +02:00
parent 9ee10fdfc8
commit e430db40aa
2 changed files with 10 additions and 3 deletions

View File

@ -61,6 +61,13 @@ public class XMLParserConfiguration extends ParserConfiguration {
*/
private Set<String> forceList;
/**
* Flag to indicate whether white space should be trimmed when parsing XML.
* The default behaviour is to trim white space. When this is set to false, inputting XML
* with tags that are the same as the value of cDataTagName is unsupported. It is recommended to set cDataTagName
* to a distinct value in this case.
*/
private boolean shouldTrimWhiteSpace;
/**

View File

@ -20,7 +20,7 @@ public class XMLTokener extends JSONTokener {
*/
public static final java.util.HashMap<String, Character> entity;
private static XMLParserConfiguration configuration = XMLParserConfiguration.ORIGINAL;;
private XMLParserConfiguration configuration = XMLParserConfiguration.ORIGINAL;;
static {
entity = new java.util.HashMap<String, Character>(8);
@ -49,11 +49,11 @@ public class XMLTokener extends JSONTokener {
public XMLTokener(Reader r, XMLParserConfiguration configuration) {
super(r);
XMLTokener.configuration = configuration;
this.configuration = configuration;
}
public XMLTokener(String s, XMLParserConfiguration configuration) {
super(s);
XMLTokener.configuration = configuration;
this.configuration = configuration;
}
/**