code: public final void rewriteXml(
          Writer out,
          Node xmlDoc,
          String aloneTags[],
          boolean outputXmlHeader
      ) {
          try {
              if (outputXmlHeader)
                  out.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n");
  
              renderXMLRecurs(
                  new PrintWriter(out),
                  xmlDoc,
                  aloneTags
              );
          } catch (Exception e) {
              e.printStackTrace();
  
              return;
          }
      }
docs: rewrite the given xmlfile
  
  @param out the writer to write the xml
  @param xmlDoc xml file as a dom node
  @param aloneTags a string array of empty tags
  @param outputXmlHeader true to output xml header