Question

I have defined a small DSL that is mostly written in the form of different types of XML files in conjuction with some property files. This works very well but I wish to create an Eclipse Editor to make editing these files easier for beginners (I already have a working parser).

The main XML file can reference some items from the .properties files and vice-versa. THe main xml file can also reference other XML files. Certain options should only be available in the main xml file based on the contents of the .properties files and based on some osgi plugins that can be added to the DSL project (the syntax is dynamic depending on context). The structure of the language is fixed but the options available in each attribute or the choice of attributes themselves changes depending on metadata contained in plugin .jar files.

Questions:

Does XText support dynamic syntax (validation changes depending on external factors)?
Does XText support XML files / .properties files?

Thank you very much for your help in advance.

Was it helpful?

Solution

Please read the Xtext documentation.

Does XText support dynamic syntax (validation changes depending on external factors)?

Xtext automatically validates the syntax using the grammar definition. Additionally, you can write arbitrary validations in Java or Check.

Does XText support XML files / .properties files?

If you define a grammar for them, of course. ;) Neither of them are too difficult.

OTHER TIPS

I don't completely understand what you are after, but if you have an XSD, have you considering turning that into an Ecore model, and then building a Xtext grammar for that? Or if you are starting from scratch, build your DSL Grammar first, then export the ecore as XSD, and use helpers like I've just posted in my http://blog2.vorburger.ch/2012/07/xtext-xml.html ? HTH.

If you don't have to have XML / XSD, and what you are after in essence really is more having a readable (say JSON-like, but strongly typed?) "generic" DSL for data structures constrained by some sort of "meta model" (say expressed in XCore, which is a DSL for an EMF Ecore model, which you can import from a XSD..), then maybe my EMF Simple Object Notation ESON (ex-EFactory) at https://github.com/vorburger/efactory is of interest to you?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top