@@ -22,6 +22,11 @@ public class XMLParserConfiguration {
22
22
*/
23
23
public static final int UNDEFINED_MAXIMUM_NESTING_DEPTH = -1 ;
24
24
25
+ /**
26
+ * The default maximum nesting depth when parsing a XML document to JSON.
27
+ */
28
+ public static final int DEFAULT_MAXIMUM_NESTING_DEPTH = 512 ;
29
+
25
30
/** Original Configuration of the XML Parser. */
26
31
public static final XMLParserConfiguration ORIGINAL
27
32
= new XMLParserConfiguration ();
@@ -64,7 +69,7 @@ public class XMLParserConfiguration {
64
69
* When parsing the XML into JSON, specifies the tags whose values should be converted
65
70
* to arrays
66
71
*/
67
- private int maxNestingDepth = UNDEFINED_MAXIMUM_NESTING_DEPTH ;
72
+ private int maxNestingDepth = DEFAULT_MAXIMUM_NESTING_DEPTH ;
68
73
69
74
/**
70
75
* Default parser configuration. Does not keep strings (tries to implicitly convert
@@ -321,8 +326,8 @@ public int getMaxNestingDepth() {
321
326
322
327
/**
323
328
* Defines the maximum nesting depth that the parser will descend before throwing an exception
324
- * when parsing the XML into JSON. The default max nesting depth is undefined , which means the
325
- * parser will go as deep as the maximum call stack size allows. Using any negative value as a
329
+ * when parsing the XML into JSON. The default max nesting depth is 512 , which means the parser
330
+ * will go as deep as the maximum call stack size allows. Using any negative value as a
326
331
* parameter is equivalent to setting no limit to the nesting depth.
327
332
* @param maxNestingDepth the maximum nesting depth allowed to the XML parser
328
333
* @return The existing configuration will not be modified. A new configuration is returned.
0 commit comments