File f = fileChooser.getSelectedFile();
String name = f.getAbsolutePath();
if (!name.endsWith(extension)) {
f = new File(name + extension);
}
Node xml = model.toXML();
OutputStream os;
try {
os = new FileOutputStream(f);
XMLHelper.write(os, xml);
} catch (IOException ex) {