@@ -22,6 +22,11 @@ public class XMLParserConfiguration {
2222 */
2323 public static final int UNDEFINED_MAXIMUM_NESTING_DEPTH = -1 ;
2424
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+
2530 /** Original Configuration of the XML Parser. */
2631 public static final XMLParserConfiguration ORIGINAL
2732 = new XMLParserConfiguration ();
@@ -64,7 +69,7 @@ public class XMLParserConfiguration {
6469 * When parsing the XML into JSON, specifies the tags whose values should be converted
6570 * to arrays
6671 */
67- private int maxNestingDepth = UNDEFINED_MAXIMUM_NESTING_DEPTH ;
72+ private int maxNestingDepth = DEFAULT_MAXIMUM_NESTING_DEPTH ;
6873
6974 /**
7075 * Default parser configuration. Does not keep strings (tries to implicitly convert
@@ -321,8 +326,8 @@ public int getMaxNestingDepth() {
321326
322327 /**
323328 * 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
326331 * parameter is equivalent to setting no limit to the nesting depth.
327332 * @param maxNestingDepth the maximum nesting depth allowed to the XML parser
328333 * @return The existing configuration will not be modified. A new configuration is returned.
0 commit comments