Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XMI model to Defined Xtext Model
XMI model to Defined Xtext Model [message #1850513] Mon, 07 March 2022 12:20 Go to next message
Cristian Gómez is currently offline Cristian GómezFriend
Messages: 19
Registered: April 2018
Junior Member
Hello everyone,

I have defined my own language with xtext, and I am able to generate a textual model for said language. I am able to open this textual model (imageDSL) with the textual editor defined for this language and with the tree modeling editor (Image1).

With this textual model, I am able, through generators, to transform it to other models such as .xmi or xml so that it can be read by another application. From this application, I am able to generate an xml and transform it into an .xmi model of the classes that make up my language. However, when I try to open the .xmi with the editor of the defined language, it only shows me the tags (image2) that make up the .xmi file and does not show it as the textual language that I have defined previously. I need from the .xmi model of my defined language to visualize the textual model from it. Could someone advise me how to go from an .xmi file to a file with the extension of the language that I have previously defined? If there is any automatic way ...

Thanks in advance,

Cristian.

  • Attachment: Image1.JPG
    (Size: 11.43KB, Downloaded 31 times)
  • Attachment: Image2.JPG
    (Size: 19.93KB, Downloaded 31 times)
Re: XMI model to Defined Xtext Model [message #1850524 is a reply to message #1850513] Mon, 07 March 2022 15:13 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7517
Registered: July 2009
Senior Member
HI

Provided all the registrations are in place, it should just work.

The underlying and very elegant philosophy of Xtext is that Xtext is just an alternative Loader/Saver for an EMF Resource, so that when an arbitrary EMF application loads the textual form it receives the parsed model form, and when it saves the model form it appears as serialized text.

Sadly some bit rot has set in Save-wise and it is a long time since I used the naive Loader. But in principle if you use the StandaloneSetup, the extensions, ResourceFactory and content type declarations that Xtext autogenerates for you in plugin.xml, it should just work.

However once you stop using the intended Xtext approach at any stage, it all falls over.

It seems like you have taken your own approach to saving as XMI rather than letting Xtext/EMF do it for free. Your extra code is therefore probably contributing to the serialization failure. You need less rather than more code.

I suggest making the load save work as you want with a very simple example, possibly fresh, possibly one of the Xtext tutorial examples. Then repair your current code.

Regards

Ed Willink
Previous Topic:Xtext & Xtend Release 2.26.0 is available now
Next Topic:Generate Files outside of the xtext project, relative to the projects location
Goto Forum:
  


Current Time: Sun Sep 25 08:40:16 GMT 2022

Powered by FUDForum. Page generated in 0.01905 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top