code: public static JSONArray toJSONArray(String string) throws JSONException {
          return (JSONArray)parse(new XMLTokener(string), true, null, false);
      }
docs: Convert a well-formed (but not necessarily valid) XML string into a
  JSONArray using the JsonML transform. 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 <code>&lt;[ [ ]]></code> are ignored.
  @param string The source string.
  @return A JSONArray containing the structured data from the XML string.
  @throws JSONException Thrown on error converting to a JSONArray