XML

open class XML

This provides static methods to convert an XML text into a JSONObject, and to covert a JSONObject into an XML text.

Author

JSON.org

Functions

Link copied to clipboard
open fun escape(string: String): String
Replace special characters with XML escapes:

& (ampersand) is replaced by &
< (less than) is replaced by <
> (greater than) is replaced by >
" (double quote) is replaced by "
' (single quote / apostrophe) is replaced by '
Link copied to clipboard
open fun noSpace(string: String)
Throw an exception if the string contains whitespace.
Link copied to clipboard
open fun stringToValue(string: String): Any
This method is the same as stringToValue.
open fun stringToValue(string: String, typeConverter: XMLXsiTypeConverter<out Any>): Any
This method tries to convert the given string value to the target object
Link copied to clipboard
open fun toJSONObject(reader: Reader): JSONObject
open fun toJSONObject(reader: Reader, keepStrings: Boolean): JSONObject
Convert a well-formed (but not necessarily valid) XML into a JSONObject.
open fun toJSONObject(string: String): JSONObject
open fun toJSONObject(string: String, keepStrings: Boolean): JSONObject
Convert a well-formed (but not necessarily valid) XML string into a JSONObject.
Link copied to clipboard
open fun toString(object: Any): String
open fun toString(object: Any, tagName: String): String
open fun toString(object: Any, tagName: String, config: XMLParserConfiguration): String
Convert a JSONObject into a well-formed, element-normal XML string.
open fun toString(object: Any, indentFactor: Int): String
open fun toString(object: Any, tagName: String, indentFactor: Int): String
open fun toString(object: Any, tagName: String, config: XMLParserConfiguration, indentFactor: Int): String
Convert a JSONObject into a well-formed, pretty printed element-normal XML string.
Link copied to clipboard
open fun unescape(string: String): String
Removes XML escapes from the string.

Properties

Link copied to clipboard
The Character '&'.
Link copied to clipboard
The Character '''.
Link copied to clipboard
The Character '!'.
Link copied to clipboard
The Character '='.
Link copied to clipboard
The Character
'>'. 
Link copied to clipboard
The Character '<'.
Link copied to clipboard
val NULL_ATTR: String = "xsi:nil"
Null attribute name
Link copied to clipboard
The Character '?'.
Link copied to clipboard
The Character '"'.
Link copied to clipboard
The Character '/'.
Link copied to clipboard
val TYPE_ATTR: String = "xsi:type"