Alexander
Alexander

Reputation: 342

Convert XML based domain model description to EMF like domain model

I'm not sure that my question is correct from EMF expert point of view. I investigate the problem

  1. I have xml file that describe domain model(set of datatypes) and corresponded xsd file that can be used for validation given domain model description
  2. This xml file can be changed by third party software. This updated is provided very seldom (one/two times in 3-4 months). In this case saving domain model as set of java class and rebuild it more suitable from other parts of application point of view

My goal is convert xml domain model to EMF domain model description, then generate genmodel file and then generate domain model as set of Java classes. how to convert xml domain model to EMF domain model description automatically? I found easy way to create ecore file from xsd. Are the any way to load my xml file using ecore description and save it as EMF like model for genearting Java class as next step

Thank you in advance Alexander

Upvotes: 0

Views: 526

Answers (1)

Karthik Rocky
Karthik Rocky

Reputation: 176

As you yourself found out, you need to crate emf model out of schema. Steps which I could immediately think of

  1. Create ecore out of schema.
  2. Generate genmodel.
  3. Generate model, edit and editor.
  4. Open manifest editor of generated editor plugin and check what is the file extension of your model instance file. This is the file extension which your xml file will stand with
  5. Right click on generated project and launch as eclipse application.
  6. Create a project and place your xml file with same extension as in step 4.
  7. Double click on the file.

Now your xml file is loaded into emf model and displayed in editor. Now its your task to build your own UI based on your customer needs using the emf model.

Please note that you can always update the schema file, generate ecore file, update the existing model. Let me know if you need some more information.

Upvotes: 1

Related Questions