code: public String encode(XML xml) throws ParserException, SAXException, IOException {
  
          DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = null;
  
          InputSource is = new InputSource(new StringReader(xml.toString()));
  
          try {
              builder = dbFactory.newDocumentBuilder();
              Document doc = builder.parse(is);
              return net.arnx.jsonic.JSON.encode(doc, true);
          } catch (SAXException e) {
              throw new ParserException(e.getMessage());
          } catch (ParserConfigurationException e) {
              throw new ParserException(e.getMessage());
          }
      }
docs: Convert a XML object to a JSON string.
  
  @param xml
  
  @return
  JSON string
  
  @throws ParserException
  @throws SAXException
  @throws IOException