code: public static JSONArray toJSONArray(XMLTokener x) throws JSONException {
      return (JSONArray) parse(x, true, null);
    }
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 content and
  tags. Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
  
  @param x
  An XMLTokener.
  @return A JSONArray containing the structured signalData from the XML string.
  @throws JSONException