code: public static JSONObject toJSONObject(XMLTokener x) throws JSONException {
      return (JSONObject) parse(x, false, null);
    }
docs: 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 object will have a "childNodes" property which will be an array of strings and JsonML
  JSONObjects.
  
  Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
  
  @param x
  An XMLTokener of the XML source text.
  @return A JSONObject containing the structured signalData from the XML string.
  @throws JSONException