I am using Sirius and Xtext to do a graphic-text two-way synchronization work, probably after I use Sirius to draw a graphic to generate Xtext text, and modifying the text will modify the graphic synchronously. When I draw with Sirius, the model will store a lot of necessary information, as shown below [enter image description here][1] I will get the XML likes this :
<siriusModel:ElementFactory>
<Elements> type="A" deviveName="A" logicalEntity="AbstractA"
<Elements> type="B" deviceName="B" logicalEntity="AbstractB"
</Elements>
</Elements>
</siriusModel:ElementFactory>
My xtext grammer is like this:
ElementFactory returns ElementFactory:
{ElementFactory}
'ElementFactory'
'{'
Elements+=Element*
'}';
Element returns Element:
{Element}
'{'
'[''type''='type=STRING']'
'[''deviceName''='deviceName=STRING']'
'[''logicalEntity''='logicalEntity=STRING']'
'}';
And my DSL looks like this:
ElementFactory{
Element{
[type="A"]
[deviceName="A"]
[logicalEntity="AbstractA"]
}
Element{
[type="B"]
[deviceName="B"]
[logicalEntity="AbstractB"]
}
}
but i don't want to show the [deviceName="A"] and [logicalEntity="AbstractA"] , I only want to this:
ElementFactory{
Element{
[type="A"]
}
Element{
[type="B"]
}
}
is there any way i can do it? Any help i would appreciate! thanks! [1]: https://i.stack.imgur.com/qh5Qy.png