mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-02 11:05:28 -04:00
fix: amend XMLParserConfiguration.clone() to include the new maxNestingDepth param.
Amend Javadoc for XML and XMLParserConfiguration classes.
This commit is contained in:
parent
401495ae86
commit
2391d248cc
@ -229,8 +229,12 @@ public class XML {
|
||||
* The JSONObject that will include the new material.
|
||||
* @param name
|
||||
* The tag name.
|
||||
* @param config
|
||||
* The XML parser configuration.
|
||||
* @param currentNestingDepth
|
||||
* The current nesting depth.
|
||||
* @return true if the close tag is processed.
|
||||
* @throws JSONException
|
||||
* @throws JSONException Thrown if any parsing error occurs.
|
||||
*/
|
||||
private static boolean parse(XMLTokener x, JSONObject context, String name, XMLParserConfiguration config, int currentNestingDepth)
|
||||
throws JSONException {
|
||||
|
@ -66,8 +66,7 @@ public class XMLParserConfiguration {
|
||||
private Set<String> forceList;
|
||||
|
||||
/**
|
||||
* When parsing the XML into JSON, specifies the tags whose values should be converted
|
||||
* to arrays
|
||||
* The maximum nesting depth when parsing a XML document to JSON.
|
||||
*/
|
||||
private int maxNestingDepth = DEFAULT_MAXIMUM_NESTING_DEPTH;
|
||||
|
||||
@ -158,14 +157,17 @@ public class XMLParserConfiguration {
|
||||
* @param xsiTypeMap <code>new HashMap<String, XMLXsiTypeConverter<?>>()</code> to parse values with attribute
|
||||
* xsi:type="integer" as integer, xsi:type="string" as string
|
||||
* @param forceList <code>new HashSet<String>()</code> to parse the provided tags' values as arrays
|
||||
* @param maxNestingDepth <code>int</code> to limit the nesting depth
|
||||
*/
|
||||
private XMLParserConfiguration (final boolean keepStrings, final String cDataTagName,
|
||||
final boolean convertNilAttributeToNull, final Map<String, XMLXsiTypeConverter<?>> xsiTypeMap, final Set<String> forceList ) {
|
||||
final boolean convertNilAttributeToNull, final Map<String, XMLXsiTypeConverter<?>> xsiTypeMap, final Set<String> forceList,
|
||||
final int maxNestingDepth) {
|
||||
this.keepStrings = keepStrings;
|
||||
this.cDataTagName = cDataTagName;
|
||||
this.convertNilAttributeToNull = convertNilAttributeToNull;
|
||||
this.xsiTypeMap = Collections.unmodifiableMap(xsiTypeMap);
|
||||
this.forceList = Collections.unmodifiableSet(forceList);
|
||||
this.maxNestingDepth = maxNestingDepth;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,7 +185,8 @@ public class XMLParserConfiguration {
|
||||
this.cDataTagName,
|
||||
this.convertNilAttributeToNull,
|
||||
this.xsiTypeMap,
|
||||
this.forceList
|
||||
this.forceList,
|
||||
this.maxNestingDepth
|
||||
);
|
||||
}
|
||||
|
||||
@ -327,8 +330,9 @@ public class XMLParserConfiguration {
|
||||
/**
|
||||
* Defines the maximum nesting depth that the parser will descend before throwing an exception
|
||||
* when parsing the XML into JSON. The default max nesting depth is 512, which means the parser
|
||||
* will go as deep as the maximum call stack size allows. Using any negative value as a
|
||||
* parameter is equivalent to setting no limit to the nesting depth.
|
||||
* will throw a JsonException if the maximum depth is reached.
|
||||
* Using any negative value as a parameter is equivalent to setting no limit to the nesting depth,
|
||||
* which means the parses will go as deep as the maximum call stack size allows.
|
||||
* @param maxNestingDepth the maximum nesting depth allowed to the XML parser
|
||||
* @return The existing configuration will not be modified. A new configuration is returned.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user