use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences_setsFormatTo1.
@Test
public void exportPreferences_setsFormatTo1() throws Exception {
Document document = exportPreferences(false, Collections.<String>emptySet());
assertEquals("1", document.getRootElement().getAttributeValue("format"));
}
use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences_setsVersionToLatest.
@Test
public void exportPreferences_setsVersionToLatest() throws Exception {
Document document = exportPreferences(false, Collections.<String>emptySet());
assertEquals(Integer.toString(Settings.VERSION), document.getRootElement().getAttributeValue("version"));
}
use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project k-9 by k9mail.
the class SettingsExporterTest method exportPreferences_ignoresGlobalSettingsWhenRequested.
@Test
public void exportPreferences_ignoresGlobalSettingsWhenRequested() throws Exception {
Document document = exportPreferences(false, Collections.<String>emptySet());
assertNull(document.getRootElement().getChild("global"));
}
use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project pcgen by PCGen.
the class NameGenPanel method loadData.
private void loadData(File path) {
if (path.isDirectory()) {
File[] dataFiles = path.listFiles(new XMLFilter());
SAXBuilder builder = new SAXBuilder();
GeneratorDtdResolver resolver = new GeneratorDtdResolver(path);
builder.setEntityResolver(resolver);
for (File dataFile : dataFiles) {
try {
URL url = dataFile.toURI().toURL();
Document nameSet = builder.build(url);
DocType dt = nameSet.getDocType();
if (dt.getElementName().equals("GENERATOR")) {
loadFromDocument(nameSet);
}
} catch (Exception e) {
Logging.errorPrint(e.getMessage(), e);
JOptionPane.showMessageDialog(this, "XML Error with file " + dataFile.getName());
}
}
loadDropdowns();
} else {
JOptionPane.showMessageDialog(this, "No data files in directory " + path.getPath());
}
}
use of iso.std.iso._20022.tech.xsd.pain_001_001.Document in project pcgen by PCGen.
the class DiceBagModel method saveToFile.
/**
* <p>Saves the dicebag to the specified file as a UTF-8 xml file, with the format
* specified above in {@code loadFromFile()}</p>
*
* @param file File to save to.
*/
void saveToFile(File file) {
try {
Document doc = new Document();
saveToDocument(doc);
XMLOutputter xmlOut = new XMLOutputter();
xmlOut.setFormat(Format.getPrettyFormat());
FileWriter fr = new FileWriter(file);
xmlOut.output(doc, fr);
fr.flush();
fr.close();
m_filePath = file.getPath();
m_changed = false;
} catch (Exception e) {
JOptionPane.showMessageDialog(GMGenSystem.inst, "File load error: " + file.getName());
Logging.errorPrint("File Load Error" + file.getName());
Logging.errorPrint(e.getMessage(), e);
}
}
Aggregations