code: private void writeXmlDocument(String path, Document doc) throws IOException {
      zip.putNextEntry(new ZipEntry(path));
      try {
        DOMSource source = new DOMSource(doc);
        StreamResult result = new StreamResult(zip);
        transformer.transform(source, result);
      }
      catch (TransformerException ex) {
        throw new IOException("Failed to generate XML: " + ex.getMessage(), ex);
      }
      finally {
        zip.closeEntry();
      }
    }
docs: Writes an XML document as binary file entry to the ZIP output stream.
  @param path Content path
  @param doc XML content
  @throws IOException I/O exception