Surya \’s Blog

… ever streaming tools and technologies….!!!

Saving the EMF model to XML File

Posted by kathayat on July 26, 2007

 public void saveModel(EObject project)
{
 try{
  @SuppressWarnings(“unused”)
  URI fileURI = URI.createFileURI(“data/test1.xml”);
  Resource poResource = new XMLResourceFactoryImpl().createResource(fileURI);
  poResource.getContents().add(project);
  poResource.save(null);
 } catch(Exception ex)
 {
  ex.printStackTrace();
 }
}

2 Responses to “Saving the EMF model to XML File”

  1. Taher Hany Galal said

    what if i need to store more than one model element in the same file this will only work for 1 model

  2. Leesa said

    Hello webmaster do you need unlimited articles for your website ?
    What if you could copy article from other pages, make it unique and publish on your website – i know the right tool for you,
    just search in google:
    loimqua’s article tool

Leave a comment