OutputStreamWriter w = new OutputStreamWriter(new FileOutputStream(outFile),"UTF-8");
ItemDestination dest = new WriterItemDestination(w,"UTF-8");
ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor(outFile.toURI());
dest.send(constructor.createDocument(outFile.toURI()));
dest.send(constructor.createElement(XML.DATABASE_NAME));
dest.send(constructor.createCharacters("\n"));
dest.send(constructor.createElement(XML.PERMISSIONS_NAME));
dest.send(constructor.createCharacters("\n"));
Iterator<Permission> permissions = db.getPermissions();
while (permissions.hasNext()) {
permissions.next().generate(constructor,dest);