Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert an XMI model-instance of Ecore to XML of the given XSD?

I am using the Ecore model which is based on imported XML Schema file (XSD). Using generated Java classes (based on Ecore model), I build an instance of the model and save it as a resource in XMI standard. This XMI file is actually an XML file which conforms to the Ecore model.

Questions:
Is it possible to convert the instance of the Ecore model from XMI format to XML format that conforms to the original XML Schema (XSD)?

Which sdks/frameworks/plugins can provide such conversion?

Thanks

like image 347
sromku Avatar asked Nov 04 '22 22:11

sromku


1 Answers

If you make sure you save the instance using the resource created by the generated XyzResourceFactoryImpl it should produce results that conform to your schema. It sounds like you saved using an XMIResourceImpl. Try invoking Generate Test Code and look at the generated XyzExample.java for how to ensure you're using the right resource implementation with the right save/load options.

like image 138
Ed Merks Avatar answered Nov 15 '22 06:11

Ed Merks