Convert a well-formed (but not necessarily valid) XML string into a JSONObject using the JsonML transform. Each XML tag is represented as a JSONObject with a "tagName" property. If the tag has attributes, then the attributes will be in the JSONObject as properties. If the tag contains children, the
(XMLTokener x)
| 265 | * @return A JSONObject containing the structured data from the XML string. |
| 266 | */ |
| 267 | public static JSONObject toJSONObject(XMLTokener x) throws JSONException { |
| 268 | return (JSONObject) parse(x, false, null); |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * Convert a well-formed (but not necessarily valid) XML string into a |