Package org.json
Class XMLParserConfiguration
java.lang.Object
org.json.XMLParserConfiguration
public class XMLParserConfiguration
extends java.lang.Object
Configuration object for the XML parser.
- Author:
- AylwardJ
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringcDataTagNameThe name of the key in a JSON Object that indicates a CDATA section.booleanconvertNilAttributeToNullWhen 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)static XMLParserConfigurationKEEP_STRINGSOriginal configuration of the XML Parser except that values are kept as strings.booleankeepStringsWhen 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)static XMLParserConfigurationORIGINALOriginal Configuration of the XML Parser. -
Constructor Summary
Constructors Constructor Description XMLParserConfiguration()Default parser configuration.XMLParserConfiguration(boolean keepStrings)Configure the parser string processing and use the default CDATA Tag Name as "content".XMLParserConfiguration(boolean keepStrings, java.lang.String cDataTagName)Configure the parser to use custom settings.XMLParserConfiguration(boolean keepStrings, java.lang.String cDataTagName, boolean convertNilAttributeToNull)Configure the parser to use custom settings.XMLParserConfiguration(java.lang.String cDataTagName)Configure the parser string processing to try and convert XML values to JSON values and use the passed CDATA Tag Name the processing value. -
Method Summary
-
Field Details
-
ORIGINAL
Original Configuration of the XML Parser. -
KEEP_STRINGS
Original configuration of the XML Parser except that values are kept as strings. -
keepStrings
public final boolean keepStringsWhen 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) -
cDataTagName
public final java.lang.String cDataTagNameThe name of the key in a JSON Object that indicates a CDATA section. Historically this has been the value "content" but can be changed. Usenullto indicate no CDATA processing. -
convertNilAttributeToNull
public final boolean convertNilAttributeToNullWhen 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)
-
-
Constructor Details
-
XMLParserConfiguration
public XMLParserConfiguration()Default parser configuration. Does not keep strings, and the CDATA Tag Name is "content". -
XMLParserConfiguration
public XMLParserConfiguration(boolean keepStrings)Configure the parser string processing and use the default CDATA Tag Name as "content".- Parameters:
keepStrings-trueto parse all values as string.falseto try and convert XML string values into a JSON value.
-
XMLParserConfiguration
public XMLParserConfiguration(java.lang.String cDataTagName)Configure the parser string processing to try and convert XML values to JSON values and use the passed CDATA Tag Name the processing value. Passnullto disable CDATA processing- Parameters:
cDataTagName-nullto disable CDATA processing. Any other value to use that value as the JSONObject key name to process as CDATA.
-
XMLParserConfiguration
public XMLParserConfiguration(boolean keepStrings, java.lang.String cDataTagName)Configure the parser to use custom settings.- Parameters:
keepStrings-trueto parse all values as string.falseto try and convert XML string values into a JSON value.cDataTagName-nullto disable CDATA processing. Any other value to use that value as the JSONObject key name to process as CDATA.
-
XMLParserConfiguration
public XMLParserConfiguration(boolean keepStrings, java.lang.String cDataTagName, boolean convertNilAttributeToNull)Configure the parser to use custom settings.- Parameters:
keepStrings-trueto parse all values as string.falseto try and convert XML string values into a JSON value.cDataTagName-nullto disable CDATA processing. Any other value to use that value as the JSONObject key name to process as CDATA.convertNilAttributeToNull-trueto parse values with attribute xsi:nil="true" as null.falseto parse values with attribute xsi:nil="true" as {"xsi:nil":true}.
-