JSONMLParserConfiguration (JSON in Java 20240205 API)

Package org.json

## Class JSONMLParserConfiguration

- java.lang.Object
- - org.json.ParserConfiguration
  - - org.json.JSONMLParserConfiguration

-     public class JSONMLParserConfiguration
      extends ParserConfiguration

  Configuration object for the XML to JSONML parser. The configuration is immutable.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_MAXIMUM_NESTING_DEPTH` | We can override the default maximum nesting depth if needed.
    `static JSONMLParserConfiguration` | `KEEP_STRINGS` | Original configuration of the XML to JSONML Parser except that values are kept as strings.
    `static JSONMLParserConfiguration` | `ORIGINAL` | Original Configuration of the XML to JSONML Parser.

    - ### Fields inherited from class org.json.ParserConfiguration

      `keepStrings, maxNestingDepth, UNDEFINED_MAXIMUM_NESTING_DEPTH`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `` | `JSONMLParserConfiguration()` | Default parser configuration.
    `protected` | `JSONMLParserConfiguration​(boolean keepStrings, int maxNestingDepth)` | Configure the parser string processing and use the default CDATA Tag Name as "content".

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected JSONMLParserConfiguration` | `clone()` | Provides a new instance of the same configuration.
    `JSONMLParserConfiguration` | `withKeepStrings​(boolean newVal)` | When parsing the XML into JSONML, specifies if values should be kept as strings (`true`), or if they should try to be guessed into JSON values (numeric, boolean, string)
    `JSONMLParserConfiguration` | `withMaxNestingDepth​(int maxNestingDepth)` | Defines the maximum nesting depth that the parser will descend before throwing an exception when parsing the XML into JSONML.

    - ### Methods inherited from class org.json.ParserConfiguration

      `getMaxNestingDepth, isKeepStrings`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_MAXIMUM_NESTING_DEPTH

          public static final int DEFAULT_MAXIMUM_NESTING_DEPTH

      We can override the default maximum nesting depth if needed.
      See Also:
        Constant Field Values

    - #### ORIGINAL

          public static final JSONMLParserConfiguration ORIGINAL

      Original Configuration of the XML to JSONML Parser.

    - #### KEEP_STRINGS

          public static final JSONMLParserConfiguration KEEP_STRINGS

      Original configuration of the XML to JSONML Parser except that values are kept as strings.

  - ### Constructor Detail

    - #### JSONMLParserConfiguration

          public JSONMLParserConfiguration()

      Default parser configuration. Does not keep strings (tries to implicitly convert values).

    - #### JSONMLParserConfiguration

          protected JSONMLParserConfiguration​(boolean keepStrings,
                                              int maxNestingDepth)

      Configure the parser string processing and use the default CDATA Tag Name as "content".
      Parameters:
        `keepStrings` - `true` to parse all values as string. `false` to try and convert XML string values into a JSON value.
        `maxNestingDepth` - `int` to limit the nesting depth

  - ### Method Detail

    - #### clone

          protected JSONMLParserConfiguration clone()

      Provides a new instance of the same configuration.
      Overrides:
        `clone` in class `ParserConfiguration`

    - #### withKeepStrings

          public JSONMLParserConfiguration withKeepStrings​(boolean newVal)

      Description copied from class: `ParserConfiguration`
      When parsing the XML into JSONML, specifies if values should be kept as strings (`true`), or if they should try to be guessed into JSON values (numeric, boolean, string)
      Overrides:
        `withKeepStrings` in class `ParserConfiguration`
      Parameters:
        `newVal` - new value to use for the `keepStrings` configuration option.
      Returns:
        The existing configuration will not be modified. A new configuration is returned.

    - #### withMaxNestingDepth

          public JSONMLParserConfiguration withMaxNestingDepth​(int maxNestingDepth)

      Description copied from class: `ParserConfiguration`
      Defines the maximum nesting depth that the parser will descend before throwing an exception when parsing the XML into JSONML. The default max nesting depth is 512, which means the parser 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.
      Overrides:
        `withMaxNestingDepth` in class `ParserConfiguration`
      Parameters:
        `maxNestingDepth` - the maximum nesting depth allowed to the XML parser
      Returns:
        The existing configuration will not be modified. A new configuration is returned.