1
votes

I have multiple data files (own XML formats, XSD Schema available for each format) which I want to load into my Eclipse RCP. I thought about of using EMF for that task and find several information about it. Is it possible to have exactly one EMF model (which is - as far as I know - saved as XMI file) which uses the model instance which is build of all XML files?

I know that I can generate the EMF model from the XSD-Schema. But I did not read that I am able to store the model instance in XML files corresponding to that Schemas. Is there any way to do that?

Surely I can use JAXB for that because in particular the task descriped above can be done with any XML binding tool. But rather than only binding XML I thought of EMF Forms or EMF Validation to work with that data.

Best regards

1

1 Answers

0
votes

Yes, you can actually load EMF instances from XML documents that conform to your XSD.

Make sure that PDE, EMF and XSD SDK are installed. Then either create a new EMF project or create a new EMF Generator model in an existing project using the "File -> New" wizard. In the process, you can select "XML Schema" in the "Model Importers" step.

When you do this, you will see in the genmodel that the GenPackage's "Resource Type" (in the "Model" category) is set to "XML".

PS: You may also want to use the org.eclipse.wst.xml.core.catalogContributions extension point in plugin.xml to register your XSD in Eclipse's XML catalog.