public void save() throws OKMException {
try {
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
FileOutputStream stream = new FileOutputStream(documentFilename);
XMLStreamWriter writer;
writer = outputFactory.createXMLStreamWriter(stream,"UTF-8");
writer.writeStartDocument("utf-8", "1.0"); // Header
writer.writeStartElement("openkm"); // openkm node
for (Iterator<OKMDocumentBean> it = docList.iterator(); it.hasNext();) {
OKMDocumentBean doc = it.next();
writer.writeStartElement("document"); // document node
writer.writeStartElement("uuid"); // uuid
writer.writeCharacters(doc.getUUID());
writer.writeEndElement();
writer.writeStartElement("path"); // path
writer.writeCharacters(doc.getPath());
writer.writeEndElement();
writer.writeStartElement("localfilename"); // localfilename
writer.writeCharacters(doc.getLocalFilename());
writer.writeEndElement();
writer.writeStartElement("name"); // name
writer.writeCharacters(doc.getName());
writer.writeEndElement();
writer.writeEndElement(); // close document
}
writer.writeEndElement(); // close openkm
writer.flush();
writer.close();
} catch (XMLStreamException ex) {
throw new OKMException(ex);
} catch (IOException ex) {
throw new OKMException(ex);