org.json
public class XML extends Object
Field Summary | |
---|---|
static Character | AMP The Character '&'. |
static Character | APOS The Character '''. |
static Character | BANG The Character '! |
static Character | EQ The Character '='. |
static Character | GT The Character '>'. |
static Character | LT The Character '<'. |
static Character | QUEST The Character '? |
static Character | QUOT The Character '"'. |
static Character | SLASH The Character '/'. |
Method Summary | |
---|---|
static String | escape(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 " |
static JSONObject | toJSONObject(String string)
Convert a well-formed (but not necessarily valid) XML string into a
JSONObject. |
static String | toString(Object o)
Convert a JSONObject into a well-formed, element-normal XML string. |
static String | toString(Object o, String tagName)
Convert a JSONObject into a well-formed, element-normal XML string. |
& (ampersand) is replaced by & < (less than) is replaced by < > (greater than) is replaced by > " (double quote) is replaced by "
Parameters: string The string to be escaped.
Returns: The escaped string.
<[ [ ]]>
are ignored.Parameters: string The source string.
Returns: A JSONObject containing the structured data from the XML string.
Throws: JSONException
Parameters: o A JSONObject.
Returns: A string.
Throws: JSONException
Parameters: o A JSONObject. tagName The optional name of the enclosing tag.
Returns: A string.
Throws: JSONException