Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Best method for generating code from XSD
Best method for generating code from XSD [message #1704929] Mon, 10 August 2015 20:08 Go to next message
Axel Biernat is currently offline Axel BiernatFriend
Messages: 2
Registered: August 2015
Junior Member
Hi folks,

working currently on a proof-of-concept but need some guidance.
Starting from a complex xsd model provided by external party I looking into an feasible approach to generate various pieces of codes (data model classes, xslt etc.).

Xpand seems to be first choice as target language is not java, but there is obviously the needed to create a model instance first. AFAIK the workflow is as follows:

XSD file -> Meta model (XSD) -> Model instance (xml) -> Xpand template -> Code

Is there any way to eliminate the need for a model instance is this case? Just evaluating the meta-model.

Any other approach to look at?

Thanks for your sharing your ideas.

Cheers,
Axel
Re: Best method for generating code from XSD [message #1705155 is a reply to message #1704929] Wed, 12 August 2015 13:25 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 607
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Xpand has built-in support for XSD type systems, i.e. the metamodel is already implicit. The org.eclipse.xtend.typesystem.xsd plugin provides this metamodel and also a reader for XML models based on the given schema.

Under the hood it used EMF XSD, and with that API it is also possible to generate an EMF metamodel and metaclasses from the XSD, and use a XMLResourceFactory to read XML with means of EMF. It would be a bit more work to explain how this is actually done.

However, if you have that you can also use Xtend very comfortable to generate code.

Kind regards,
~Karsten


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Best method for generating code from XSD [message #1705164 is a reply to message #1705155] Wed, 12 August 2015 14:20 Go to previous messageGo to next message
Axel Biernat is currently offline Axel BiernatFriend
Messages: 2
Registered: August 2015
Junior Member
Hi Karsten,

not sure, whether I got you right. Recently started with Eclipse Modeling Tooling and still in the learning curve.

As far as I understand you explained that based on the schema (meta model) a model can be evaluated. But here I facing an issue, because the requirement is different in my case.

Let me rephrase my question.

We have a XSD schema provided by external describing a complex data model (element and types). Without having a specific xml of the schema I would like to generate various artefacts, e.g. class for each element, xslt transformations for each element and so. In fact it's pretty similiar to the XSDtoJava generators such as Apache XMLBeans. But in fact our programming language doesn't have a XSD schema generator yet Sad
Can I do so without having an xml with any of the eclipse modelling framework tooling (xpand/xtext, acceleo,...)?

Cheers,
Axel
Re: Best method for generating code from XSD [message #1742923 is a reply to message #1705164] Thu, 08 September 2016 15:20 Go to previous message
pere joseph rodríguez is currently offline pere joseph rodríguezFriend
Messages: 12
Registered: October 2014
Junior Member
check this link to convert xsd to ecore, and then use acceleo to generate the code.
http://stackoverflow.com/questions/671555/how-to-convert-xsd-to-ecore-emf/4614035
Previous Topic:[Acceleo] Problems generating from a referenced metamodel
Next Topic:[Acceleo] Dynamic Template Plugin
Goto Forum:
  


Current Time: Sat Jul 21 22:51:37 GMT 2018

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

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

Back to the top