|Re: Loading and navigating a DSL Model [message #916156 is a reply to message #916144]
||Tue, 18 September 2012 16:15
| Hallvard Traetteberg
Registered: July 2009
Location: Trondheim, Norway
On 18.09.12 08.59, Matthias Villiger wrote:
> I am a beginner in Xtext and have a few basic questions. Maybe you can
> give me some examples/hints or point me into the right direction. :)
You should have some understanding of EMF to utilize Xtext, like
modeling with Ecore, loading resources and navigating EObjects.
> Now I would like to replace this XML by a new DSL using Xtext. Does
> Xtext provide anything that gives me the same possibilities as with the
When Xtext parses a file, you get a DOM consisting of instances of your
Ecore classes assembled into a hierarchy corresponding to the parsed
> So after defining the DSL and creating a sample file, is there a
> possibility to programmatically load this example file into a memory
> model using Xtext libraries?
Xtext registers a so-called resource factory for a file extension, so
whenever such a file is loaded by EMF's the parser will kick in and
build the EObject structure for you.
> And if yes, how can this be achieved and how can the model then be
> traversed to access the information of the example file?
When you have loaded the resource, you just traverse its contents.
Powered by FUDForum
. Page generated in 0.02648 seconds