public final class JSONML extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static JSONArray |
toJSONArray(java.lang.String string)
Convert a well-formed (but not necessarily valid) XML string into a
JSONArray using the JsonML transform.
|
static JSONArray |
toJSONArray(XMLTokener x)
Convert a well-formed (but not necessarily valid) XML string into a
JSONArray using the JsonML transform.
|
static java.lang.String |
toString(JSONArray ja)
Reverse the JSONML transformation, making an XML text from a JSONArray.
|
public static JSONArray toJSONArray(java.lang.String string) throws JSONException
Each XML tag is represented as
a JSONArray in which the first element is the tag name. If the tag has
attributes, then the second element will be JSONObject containing the
name/value pairs. If the tag contains children, then strings and
JSONArrays will represent the child tags.
Comments, prologs, DTDs, and <[ [ ]]>
are ignored.
string
- the source stringJSONException
- if something goes wrongpublic static JSONArray toJSONArray(XMLTokener x) throws JSONException
Each XML tag is represented as
a JSONArray in which the first element is the tag name. If the tag has
attributes, then the second element will be JSONObject containing the
name/value pairs. If the tag contains children, then strings and
JSONArrays will represent the child content and tags.
Comments, prologs, DTDs, and <[ [ ]]>
are ignored.
x
- an XMLTokenerJSONException
- if something goes wrongpublic static java.lang.String toString(JSONArray ja) throws JSONException
ja
- a JSONArrayJSONException
- if something goes wrong