use of org.openforis.collect.persistence.xml.CollectSurveyIdmlBinder in project collect by openforis.
the class CollectRelationalTest method loadSurvey.
@BeforeClass
public static void loadSurvey() throws IdmlParseException, FileNotFoundException {
InputStream is = ClassLoader.getSystemResourceAsStream("test.idm.xml");
// InputStream is = new FileInputStream("/home/gino/workspace/of/idm/idm-test/src/main/resources/test.idm.xml");
// InputStream is = new FileInputStream("D:/data/workspace/idm/idm-test/src/main/resources/test.idm.xml");
// InputStream is = new FileInputStream("/home/gino/workspace/faofin/tz/naforma-idm/tanzania-naforma.idm.xml");
CollectSurveyContext ctx = new CollectSurveyContext(new ExpressionFactory(), null);
// DefaultSurveyContext ctx = new DefaultSurveyContext();
CollectSurveyIdmlBinder binder = new CollectSurveyIdmlBinder(ctx);
survey = (CollectSurvey) binder.unmarshal(is);
}
use of org.openforis.collect.persistence.xml.CollectSurveyIdmlBinder in project collect by openforis.
the class CollectEarthProjectFileCreatorImpl method createPlacemark.
private File createPlacemark(CollectSurvey survey) throws IOException {
File file = File.createTempFile("collect-earth-placemark.idm", ".xml");
FileOutputStream os = new FileOutputStream(file);
CollectSurveyIdmlBinder binder = new CollectSurveyIdmlBinder(survey.getContext());
try {
binder.marshal(survey, os, true, true, false);
} finally {
IOUtils.closeQuietly(os);
}
return file;
}
Aggregations