Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [Xtend] How to create an XSD schema?
[Xtend] How to create an XSD schema? [message #511427] Mon, 01 February 2010 15:23 Go to next message
Peter Keller is currently offline Peter KellerFriend
Messages: 14
Registered: October 2009
Junior Member
Dear all,

I am fairly new to Xtend, and I am wondering what are good ways of using it to create and write out an XSD schema. I could write an Xpand template of course, but to me it seems better to use the XSD metamodel directly if possible: I wouldn't have to worry about getting the syntax of the output file right.

I have figured out that I can create a UML model in an XtendComponent workflow component with Xtend code like this:

create uml::Model this newModel( String name ):
   this.setName(name) ->
   newPackage(this, "MyPackage")
 ;
   
create uml::Package this newPackage( uml::Model umlModel, String name ):
   this.setName(name) ->
   this.setNestingPackage(umlModel)
 ;


and write it out using XmiWriter. Is a similar approach possible using org.eclipse.xtend.typesystem.xsd.XSDMetaModel and XMLWriter? I have spent some time reading through the Xpand documentation, and also looking for examples where someone else has done this already, but without finding anything.

[Of course, I would be transforming from an input model, not creating an XSD schema from nothing. I just left that side of things out of the example above because I already know how to read a model.]

Any hints appreciated, and apologies if I have missed something obvious.
Regards,
Peter.

[Updated on: Mon, 01 February 2010 15:25]

Report message to a moderator

Re: [Xtend] How to create an XSD schema? [message #511904 is a reply to message #511427] Wed, 03 February 2010 11:25 Go to previous message
Peter Keller is currently offline Peter KellerFriend
Messages: 14
Registered: October 2009
Junior Member
For the record, I found the answer in the end with hints from
http://turtle-on-a-fence-post.blogspot.com/2008/08/recently- i-have-needed-to-interogate.html and http://oaw-forum.itemis.de/forum/viewtopic.php?showtopic=133 8

You can use the XSD adapter with the

XML Schema for XML Schmas as the metamodel, and then write extensions like this:

create xmlschema::SchemaType this newSchema ():
this.setVersion("1.2.3") ->
...
;


and off I go.

My next problem (how to instantiate QName) was answered here: http://oaw-forum.itemis.de/forum/viewtopic.php?showtopic=119 0. The extension statement is now this of course:

extension org::eclipse::xtend::typesystem::xsd::lib::qname;

[Updated on: Tue, 20 July 2010 16:28]

Report message to a moderator

Previous Topic:[QVTo] Caption for symbols/icons used in Metamodel Explorer
Next Topic:[ATL] Beginner question, How helpers work ?
Goto Forum:
  


Current Time: Thu Apr 25 01:12:45 GMT 2024

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

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

Back to the top