| 
 | ||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.opencms.json.JSONML
public final class JSONML
This provides static methods to convert an XML text into a JSONObject, and to convert a JSONObject into an XML text using the JsonML transform.
| Method Summary | |
|---|---|
| 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. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Method Detail | 
|---|
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 string
JSONException - if something goes wrong
public 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 XMLTokener
JSONException - if something goes wrong
public static java.lang.String toString(JSONArray ja)
                                 throws JSONException
ja - a JSONArray
JSONException - if something goes wrong| 
 | ||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||