Using xText with existing model and Resource [message #994066] |
Wed, 26 December 2012 09:48 |
|
Hi,
I want to use xText in following scenario:
I have existing EMF models which are persisted to a local file (using Resource) (as xml)
sfs (semantic file system) takes that content to a backend using REST and handled on backend using ResourceHandlers.
I am targeting to create a DSL for the EMF Model but finally wants to push content into xml only.
This also means that i can read existing xml in DSL format.
How should i approach this ?
I went through xText documentation but still don't know how to read xmi into DSL format and save DSL format to xmi.
I also referred to http://blog.efftinge.de/2009/11/xtext-using-existing-ecore-models.html but wasn't able to make it work.
I try to load an existing xmi file using the DSL editor, it shows xmi itself with keywords in my grammer highlighted and i try to save the DSL content and open using some Sample Ecore Editor, i get errors.
Regards,
Ashwani Kr Sharma
[Updated on: Wed, 26 December 2012 09:59] Report message to a moderator
|
|
|
|
Re: Using xText with existing model and Resource [message #994350 is a reply to message #994219] |
Thu, 27 December 2012 04:16 |
|
Thanks AJ.
I have gone through these links. I am able to generated my grammar generated from Ecore model (using the wizard). Though i have to still edit the grammar to meet my requirements.
I read through XTextResource documentation also. I expected that i can hook into the generated editor code and do something to serialize DSL into xmi. But i am not able to figure out where to start.
Also my target is to read the xmi files serialized by other XMLResource and present it in the DSL form according to my grammer.
Quote:Updating comment to specify the requirement more clearly:
I have existing editors that persist values into XML format. I can't change the persistency format. I want to provide alternate dsl editor for the existing use cases. The existing XML have to be read as dsl format and content from dsl editor have to be persisted into XML format.
Are you aware of any code snippet\example which showcases this ?
Regards,
Ashwani Kr Sharma
[Updated on: Thu, 27 December 2012 14:58] Report message to a moderator
|
|
|
Re: Using xText with existing model and Resource [message #995610 is a reply to message #994350] |
Sun, 30 December 2012 17:03 |
|
Hi,
I currently found a way that i will load the xmi of existing model (using XMIResource) and take the EOBject and move it to another XTextResource. If i save XTextResource it persists it as DSL format. Now on each save of XTextResource i have to sync its content to the xmi file.
I have no option to create another file for DSL format and keep its content in sync with xmi format.
What do you guys feel about this approach ?
Regards,
Ashwani Kr Sharma
|
|
|
|
Powered by
FUDForum. Page generated in 0.06487 seconds