Skip to main content



      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 16:08 Go to next message
Eclipse UserFriend
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 09:25 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Best method for generating code from XSD [message #1705164 is a reply to message #1705155] Wed, 12 August 2015 10:20 Go to previous messageGo to next message
Eclipse UserFriend
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 11:20 Go to previous message
Eclipse UserFriend
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: Thu May 15 18:49:07 EDT 2025

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

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

Back to the top