Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Integrate xml file instead of own dsl into xtext framework
Integrate xml file instead of own dsl into xtext framework [message #1049710] Fri, 26 April 2013 07:19 Go to next message
kon f is currently offline kon fFriend
Messages: 152
Registered: March 2012
Senior Member
Hey Smile

I've used Xtext for a dsl while ago and it is pretty nice! Smile Now, I'm working in a project where xml is used instead of an own dsl. This has been there for a while and cannot changed anymore to a dsl.

The current process implies tasks like parsing the actual xml file (jaxb), pushing all information to the EMF model and performing some semantical validation on the model. The maintenance is really time consuming and error-prone since changes have to be made on several places.

Since this entire process is quite similar to what Xtext does (except for the xml file), I was wondering if I somehow could integrate the xml format into the Xtext framework. So far, I found two difference approaches:

- Keep the current xml editor and adjust the ANTLR parser. E.g. ANTLR needs to be aware of < and > character. But this also means that I couldn't use the features that are provided by the Xtext editor like error marking, element navigation, quick fixes and so on.

- With the second approach I would reverse engineering the current xml schema file with the xtext grammar dsl, like the following example:

Model:
  greetings+=Greeting*;
  
Greeting:
  '<Hello>' name=ID '!</Hello>';


What do you think? Any further suggestions? Does it seem strange Smile ?

I really appreciate your thoughts Smile

Thank you.

Kon
Re: Integrate xml file instead of own dsl into xtext framework [message #1051198 is a reply to message #1049710] Sun, 28 April 2013 11:22 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
You could also generate an ecore file from the XSD and directly read in
your XML files as EMF resources. Then perform EMF validation on them.


Am 26.04.13 09:19, schrieb kon fri:
> Hey :)
>
> I've used Xtext for a dsl while ago and it is pretty nice! :) Now, I'm
> working in a project where xml is used instead of an own dsl. This has
> been there for a while and cannot changed anymore to a dsl.
>
> The current process implies tasks like parsing the actual xml file
> (jaxb), pushing all information to the EMF model and performing some
> semantical validation on the model. The maintenance is really time
> consuming and error-prone since changes have to be made on several places.
>
> Since this entire process is quite similar to what Xtext does (except
> for the xml file), I was wondering if I somehow could integrate the xml
> format into the Xtext framework. So far, I found two difference approaches:
>
> - Keep the current xml editor and adjust the ANTLR parser. E.g. ANTLR
> needs to be aware of < and > character. But this also means that I
> couldn't use the features that are provided by the Xtext editor like
> error marking, element navigation, quick fixes and so on.
>
> - With the second approach I would reverse engineering the current xml
> schema file with the xtext grammar dsl, like the following example:
>
>
> Model:
> greetings+=Greeting*;
>
> Greeting:
> '<Hello>' name=ID '!</Hello>';
>
> What do you think? Any further suggestions? Does it seem strange :) ?
> I really appreciate your thoughts :)
> Thank you.
>
> Kon


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Previous Topic:Classes not being resolved when exporting as plugin
Next Topic:Check duplicate name in the same Scop
Goto Forum:
  


Current Time: Fri Apr 19 06:02:05 GMT 2024

Powered by FUDForum. Page generated in 0.01950 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top