code: public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator)
    throws IOException {
      XMLOutputter outputter = new XMLOutputter();
      Format format = Format.getPrettyFormat();
      format.setEncoding(encoding);
      format.setIndent(indent);
      format.setLineSeparator(lineSeparator);
      outputter.setFormat(format);
      outputter.output(getDocument(), outputStream);
    }
docs: Serializes the database to the output stream.
  
  @param outputStream the output
  @param encoding the encoding to use
  @param indent the indent
  @param lineSeparator the lineSeparator
  @throws IOException in case the xml could not be written