code: public final void rewriteXml(
          Writer out,
          String xmlFile,
          String aloneTags[],
          boolean outputXmlHeader
      ) {
          try {
              DocumentBuilderFactory fact = CDocumentBuilderFactory.newParser();
              Document xmlDoc =
                  fact.newDocumentBuilder()
                      .parse(new InputSource(new StringReader(xmlFile)));
              rewriteXml(
                  out,
                  xmlDoc,
                  aloneTags,
                  outputXmlHeader
              );
          } catch (Exception e) {
              e.printStackTrace();
  
              return;
          }
      }
docs: rewrite the given xmlfile
  
  @param out the writer to write the xml
  @param xmlFile xml file as a string
  @param aloneTags a string array of empty tags
  @param outputXmlHeader true to output xml header