0

I am trying to create an instance of an ecore file so I can store data in it. I will serialize it and store it as XMI (and then load it if it exist). In my case I cannot use genmodel and "create dynamic instance". I found this tutorial which create the ecore model itself programmatically, but I want to load an ecore file and then create an instance of it using some general factory.

How can I achieve this?

Thank you for your time and help

Fhl
  • 1,079
  • 1
  • 12
  • 26

2 Answers2

1

you may have a look at http://www.ibm.com/developerworks/library/os-eclipse-dynamicemf/index.html

(with the difference of getting the eclasses and estructural features by reading the ecore)

Christian Dietrich
  • 11,778
  • 4
  • 24
  • 32
0

In the tutorial they use ResourceSet.createResource() to create a new resource.

If you want to load an existing resource, you should try ResourceSet.getResource().

Fabien Fleureau
  • 693
  • 5
  • 14