capint
12/6/2015 - 2:42 PM

EMF >> Resource >> Save, load

EMF >> Resource >> Save, load

ResourceSet resourceSet = new ResourceSetImpl(); 
URI fileURI = 
    URI.createFileURI(new File("mypo.xml").getAbsolutePath()); 
Resource poResource = resourceSet.createResource(fileURI); 
poResource.getContents().add(aPurchaseOrder); 
poResource.save(null); 
ResourceSet resourceSet = new ResourceSetImpl(); 
URI fileURI = 
    URI.createFileURI(new File("mypo.xml").getAbsolutePath()); 
Resource poResource = resourceSet.getResource(fileURI, true); 
PurchaseOrder aPurchaseOrder = 
    (PurchaseOrder)poResource.getContents().get(0);