use of com.axelor.data.xml.XMLImporter in project open-platform-demo by axelor.
the class XMLImportTest method test.
@Test
public void test() throws FileNotFoundException {
XMLImporter importer = new XMLImporter("data/xml-config.xml");
Map<String, Object> context = new HashMap<>();
context.put("LOCATION", "FR");
context.put("DATE_FORMAT", "dd/MM/yyyy");
importer.setContext(context);
importer.run(new ImportTask() {
@Override
public void configure() throws IOException {
input("contacts.xml", new File("data/xml/contacts.xml"));
input("contacts.xml", new File("data/xml/contacts-non-unicode.xml"), Charset.forName("ISO-8859-15"));
}
@Override
public boolean handle(ImportException exception) {
System.err.println("Import error: " + exception);
return true;
}
});
}
Aggregations