Soulimane Kamni
Soulimane Kamni

Reputation: 15

How can I transform the xtext DSL elements into XML?

I have created a grammar using xtext, and generated the DSL. Now, I want to transform the DSL elements (program that is conforming to the grammar) to XML elements. So, I am wondering if there is a framework that allows to do that using Java for example. I could open the files having the extension of the DSL using the eclipse editor "Sample Reflective Ecore Model Editor" and could visualize the elements of the DSL. DdTe4.png

Upvotes: 0

Views: 213

Answers (2)

Soulimane Kamni
Soulimane Kamni

Reputation: 15

I found what I was looking for. I am using Xtend with Xtext. A ".xtend" file is generated once the grammar is compiled. This file contains a method called doGenerate. It is here where I am transforming my code which is conforming to its xtext grammar to a Capella XML and inject it directly in the "melodymodeller" Capella project file.

Thank you all for your answers.

Upvotes: 0

Andreas Graf
Andreas Graf

Reputation: 11

Do you mean a transformation to the Capella Model? Then I would suggest not the XML, but bundle the Capella EMF model with your Xtext RCP and do a model-to-model transformation based on EMF (I would suggest Xtend, but QVT, Acceleo etc. can be used, too)

Upvotes: 1

Related Questions