code: public final String rewriteXml(
          Node xmlDoc,
          String aloneTags[],
          boolean outputXmlHeader
      ) {
          try {
              StringWriter sOut = new StringWriter();
              rewriteXml(
                  sOut,
                  xmlDoc,
                  aloneTags,
                  outputXmlHeader
              );
  
              return sOut.toString();
          } catch (Exception e) {
              e.printStackTrace();
  
              return null;
          }
      }
docs: rewrite the given xmlfile
  
  @param xmlDoc xml file as a dom node
  @param aloneTags a string array of empty tags
  @param outputXmlHeader true to output xml header
  
  @return the rewrited xml.