XSD -> ecore -> Xtext: How to deal with anyType in Xtext Grammar? [message #1815744] |
Wed, 09 October 2019 17:26 |
Brandon Lewis Messages: 268 Registered: May 2012 |
Senior Member |
|
|
Searching the forums, I've found this example from 5 years ago:
https://www.eclipse.org/forums/index.php/m/1696134/?srch=xtext+anyType#msg_1696134
I've taken a IEEE standard specified in XSD, read it in and created an ecore model from it. I've also created an Xtext project from that model.
My customers, for whatever reason (and I no longer have the energy to debate with them), hate XML so I've used the Xtext DSL grammar to "yamlize" the data storage.
So far it's been fairly straightforward (although I've not created a model using my DSL and saved as XML, but in theory that should work down the line).
The original XSD makes use of the xsd construct to allow the spec to be extended:
<xs:element name="vendorExtensions">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="lax" maxOccurs="unbounded">
As mentioned in the linked forum post, my default grammar (generated by the new Xtext Project wizard from my ecore model), generates a rule without any content:
VendorExtensionsType returns VendorExtensionsType:
{VendorExtensionsType}
'VendorExtensionsType'
;
And the VendorExtensionsType contains a FeatureMap:
protected FeatureMap any;
I'm at a complete loss for understanding what I can put into my grammar for this rule that will be understood as a FeatureMap
I've tried creating another ecore model where I create classes that extend the VendorExtensionsType, but I can't quite get anything working. (all kinds of weird Xtext messages regarding super etc... can't recall them off the top of my head).
Any tips on where to start? Or any examples of anything like this? The original forum post I linked to went nowhere, so I'm worried.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03170 seconds