Package org.json

Class XMLParserConfiguration

java.lang.Object
org.json.ParserConfiguration
org.json.XMLParserConfiguration

@Deprecated public class XMLParserConfiguration extends ParserConfiguration
Deprecated.
Configuration object for the XML parser. The configuration is immutable.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Deprecated.
    Original configuration of the XML Parser except that values are kept as strings.
    Deprecated.
    Original Configuration of the XML Parser.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Default parser configuration.
    XMLParserConfiguration(boolean keepStrings)
    Deprecated.
    This constructor has been deprecated in favor of using the new builder pattern for the configuration.
    XMLParserConfiguration(boolean keepStrings, String cDataTagName)
    Deprecated.
    This constructor has been deprecated in favor of using the new builder pattern for the configuration.
    XMLParserConfiguration(boolean keepStrings, String cDataTagName, boolean convertNilAttributeToNull)
    Deprecated.
    This constructor has been deprecated in favor of using the new builder pattern for the configuration.
    Deprecated.
    This constructor has been deprecated in favor of using the new builder pattern for the configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    The name of the key in a JSON Object that indicates a CDATA section.
    Deprecated.
    When parsing the XML into JSON, specifies that tags that will be converted to arrays in this configuration Set<String> to parse the provided tags' values as arrays
    Deprecated.
    When parsing the XML into JSON, specifies that the values with attribute xsi:type will be converted to target type defined to client in this configuration Map<String, XMLXsiTypeConverter<?>> to parse values with attribute xsi:type="integer" as integer, xsi:type="string" as string
    boolean
    Deprecated.
    When parsing the XML into JSON, specifies if values with attribute xsi:nil="true" should be kept as attribute(false), or they should be converted to null(true)
    Deprecated.
    The name of the key in a JSON Object that indicates a CDATA section.
    Deprecated.
    When parsing the XML into JSON, specifies if values with attribute xsi:nil="true" should be kept as attribute(false), or they should be converted to null(true)
    withForceList(Set<String> forceList)
    Deprecated.
    When parsing the XML into JSON, specifies that tags that will be converted to arrays in this configuration Set<String> to parse the provided tags' values as arrays
    withKeepStrings(boolean newVal)
    Deprecated.
    When parsing the XML into JSON, specifies if values should be kept as strings (true), or if they should try to be guessed into JSON values (numeric, boolean, string)
    withMaxNestingDepth(int maxNestingDepth)
    Deprecated.
    Defines the maximum nesting depth that the parser will descend before throwing an exception when parsing the XML into JSON.
    Deprecated.
    When parsing the XML into JSON, specifies that the values with attribute xsi:type will be converted to target type defined to client in this configuration Map<String, XMLXsiTypeConverter<?>> to parse values with attribute xsi:type="integer" as integer, xsi:type="string" as string

    Methods inherited from class org.json.ParserConfiguration

    getMaxNestingDepth, isKeepStrings

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ORIGINAL

      public static final XMLParserConfiguration ORIGINAL
      Deprecated.
      Original Configuration of the XML Parser.
    • KEEP_STRINGS

      public static final XMLParserConfiguration KEEP_STRINGS
      Deprecated.
      Original configuration of the XML Parser except that values are kept as strings.
  • Constructor Details

    • XMLParserConfiguration

      public XMLParserConfiguration()
      Deprecated.
      Default parser configuration. Does not keep strings (tries to implicitly convert values), and the CDATA Tag Name is "content".
    • XMLParserConfiguration

      @Deprecated public XMLParserConfiguration(boolean keepStrings)
      Deprecated.
      This constructor has been deprecated in favor of using the new builder pattern for the configuration. This constructor may be removed in a future release.
      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.
    • XMLParserConfiguration

      @Deprecated public XMLParserConfiguration(String cDataTagName)
      Deprecated.
      This constructor has been deprecated in favor of using the new builder pattern for the configuration. This constructor may be removed in a future release.
      Configure the parser string processing to try and convert XML values to JSON values and use the passed CDATA Tag Name the processing value. Pass null to disable CDATA processing
      Parameters:
      cDataTagName - null to disable CDATA processing. Any other value to use that value as the JSONObject key name to process as CDATA.
    • XMLParserConfiguration

      @Deprecated public XMLParserConfiguration(boolean keepStrings, String cDataTagName)
      Deprecated.
      This constructor has been deprecated in favor of using the new builder pattern for the configuration. This constructor may be removed in a future release.
      Configure the parser to use custom settings.
      Parameters:
      keepStrings - true to parse all values as string. false to try and convert XML string values into a JSON value.
      cDataTagName - null to disable CDATA processing. Any other value to use that value as the JSONObject key name to process as CDATA.
    • XMLParserConfiguration

      @Deprecated public XMLParserConfiguration(boolean keepStrings, String cDataTagName, boolean convertNilAttributeToNull)
      Deprecated.
      This constructor has been deprecated in favor of using the new builder pattern for the configuration. This constructor may be removed or marked private in a future release.
      Configure the parser to use custom settings.
      Parameters:
      keepStrings - true to parse all values as string. false to try and convert XML string values into a JSON value.
      cDataTagName - null to disable CDATA processing. Any other value to use that value as the JSONObject key name to process as CDATA.
      convertNilAttributeToNull - true to parse values with attribute xsi:nil="true" as null. false to parse values with attribute xsi:nil="true" as {"xsi:nil":true}.
  • Method Details

    • withKeepStrings

      public XMLParserConfiguration withKeepStrings(boolean newVal)
      Deprecated.
      When parsing the XML into JSON, 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.
    • getcDataTagName

      public String getcDataTagName()
      Deprecated.
      The name of the key in a JSON Object that indicates a CDATA section. Historically this has been the value "content" but can be changed. Use null to indicate no CDATA processing.
      Returns:
      The cDataTagName configuration value.
    • withcDataTagName

      public XMLParserConfiguration withcDataTagName(String newVal)
      Deprecated.
      The name of the key in a JSON Object that indicates a CDATA section. Historically this has been the value "content" but can be changed. Use null to indicate no CDATA processing.
      Parameters:
      newVal - new value to use for the cDataTagName configuration option.
      Returns:
      The existing configuration will not be modified. A new configuration is returned.
    • isConvertNilAttributeToNull

      public boolean isConvertNilAttributeToNull()
      Deprecated.
      When parsing the XML into JSON, specifies if values with attribute xsi:nil="true" should be kept as attribute(false), or they should be converted to null(true)
      Returns:
      The convertNilAttributeToNull configuration value.
    • withConvertNilAttributeToNull

      public XMLParserConfiguration withConvertNilAttributeToNull(boolean newVal)
      Deprecated.
      When parsing the XML into JSON, specifies if values with attribute xsi:nil="true" should be kept as attribute(false), or they should be converted to null(true)
      Parameters:
      newVal - new value to use for the convertNilAttributeToNull configuration option.
      Returns:
      The existing configuration will not be modified. A new configuration is returned.
    • getXsiTypeMap

      public Map<String,XMLXsiTypeConverter<?>> getXsiTypeMap()
      Deprecated.
      When parsing the XML into JSON, specifies that the values with attribute xsi:type will be converted to target type defined to client in this configuration Map<String, XMLXsiTypeConverter<?>> to parse values with attribute xsi:type="integer" as integer, xsi:type="string" as string
      Returns:
      xsiTypeMap unmodifiable configuration map.
    • withXsiTypeMap

      public XMLParserConfiguration withXsiTypeMap(Map<String,XMLXsiTypeConverter<?>> xsiTypeMap)
      Deprecated.
      When parsing the XML into JSON, specifies that the values with attribute xsi:type will be converted to target type defined to client in this configuration Map<String, XMLXsiTypeConverter<?>> to parse values with attribute xsi:type="integer" as integer, xsi:type="string" as string
      Parameters:
      xsiTypeMap - new HashMap<String, XMLXsiTypeConverter<?>>() to parse values with attribute xsi:type="integer" as integer, xsi:type="string" as string
      Returns:
      The existing configuration will not be modified. A new configuration is returned.
    • getForceList

      public Set<String> getForceList()
      Deprecated.
      When parsing the XML into JSON, specifies that tags that will be converted to arrays in this configuration Set<String> to parse the provided tags' values as arrays
      Returns:
      forceList unmodifiable configuration set.
    • withForceList

      public XMLParserConfiguration withForceList(Set<String> forceList)
      Deprecated.
      When parsing the XML into JSON, specifies that tags that will be converted to arrays in this configuration Set<String> to parse the provided tags' values as arrays
      Parameters:
      forceList - new HashSet<String>() to parse the provided tags' values as arrays
      Returns:
      The existing configuration will not be modified. A new configuration is returned.
    • withMaxNestingDepth

      public XMLParserConfiguration withMaxNestingDepth(int maxNestingDepth)
      Deprecated.
      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 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.