final String file, final String encoding, Set<String> keySet) throws IOException {
// forcing to use UTF8 output format for some problems with
// xml export in other encodings
SaveSession ss = getSaveSession("UTF8", new File(file));
VerifyingWriter ps = ss.getWriter();
MSBibDatabase md = new MSBibDatabase(database, keySet);
// PS: DOES NOT SUPPORT EXPORTING ONLY A SET OF ENTRIES
try {
DOMSource source = new DOMSource(md.getDOMrepresentation());
StreamResult result = new StreamResult(ps);
Transformer trans = TransformerFactory.newInstance().newTransformer();
trans.setOutputProperty(OutputKeys.INDENT, "yes");
trans.transform(source, result);
}