Skip to content
Donatas Čiukšys edited this page Jan 31, 2018 · 8 revisions

Manually transform XSD to eCore and GenModel

  1. In Eclipse: File -> New -> Project...
  2. Select Eclipse Modeling Framework -> EMF Project
  3. Specify project name
  4. In window "Select a Model Importer" choose "XML Schema"

Moving eCore and GenModel files from one project to the other

  1. Open .ecore file and edit attribute nsURI of the root element to contain relative path to the XSD file.
  2. Open .genmodel file and:
    1. edit root element attribute modelDirectory. It should contain something like {projectRootDir}/emf-gen
    2. edit child element <foreignModel>. It should contain relative path to the XSD file.

BPMN example

class Main {
    def static void main(String[] args) {
        val f = new Bpmn2ResourceFactoryImpl
        //val f = new Bpmn2XMIResourceFactoryImpl
        val p = Bpmn2Package.eINSTANCE
        Resource.Factory.Registry.INSTANCE.extensionToFactoryMap.put(“bpmn”, f)
        val rs = new ResourceSetImpl
        val r = rs.getResource(URI.createURI(“SampleProcess.bpmn”),true)
        r.load(null)
        println(”’
            «FOR c : r.contents»
            «IF c instanceof DocumentRoot»
            «IF c.definitions != null»
            «c.definitions.rootElements»
            «ENDIF»
            «ENDIF»
            «ENDFOR»
        ”’)
    }
}