Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Using JET on xsd compliant xml
Using JET on xsd compliant xml [message #66299] Wed, 03 January 2007 12:42 Go to next message
Eclipse UserFriend
Originally posted by: rtv222.gmail.com

Hi,

We have a .xsd to define relationships between entities we model.
(This .xsd gives us complexTypes and elements to define the entities
that we model, thier relationships and attributes)
We are trying to create an EMF model by importing this .xsd and
then generating an EMF/GMF editor to create xml compliant with
our modeling .xsd.

How can we use JET to browse EMF editor created xml via ecore EMF api
and generate java code ?

Thanks,
Rajesh
Re: Using JET on xsd compliant xml [message #68252 is a reply to message #66299] Tue, 16 January 2007 16:04 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Rajesh:

You asked:
> How can we use JET to browse EMF editor created xml via ecore EMF api
> and generate java code ?

do the following:
1) Create a new EMFT JET Project. EMFT JET project names should be valid
plug-in names - something like: dump.my.emf.model
2) Open plugin.xml, switch to the 'Extensions' tab, expand the tree and
select 'transform'. Set the 'modelLoader' attribute to
'org.eclipse.jet.emf'.
3) Save and exit the Plug-in Manifest Editor.
4) Find a instance of the document created by your EMF-created editor.
Select it.
5a) If the file has an XML extension, right click, and click Run As > Input
for JET Transformation
5b) If the file does not have an XML extesino, right click, and chick Run As
> Run... Then select JET Transformation, and click the 'New' icon.
6) In the ID drop-down, select the name of the project created in 1). Click
Run.

Although you have written no code, the above should execute, and produce a
file dump.xml in the root of the project containing th input selected in 4).
Note that dump.xml may not be an exact replica of the input - it is the
input document as seen by JET's XPath engine.

You can enhance this JET transformation to create other files/folders or
projects by including appropriate <ws:file>, <ws:folder> and <ws:project>
tags in templates/main.jet.

Each ws:file tag requires you to create a new JET template that provides the
file contents.

Lastly, you do not have to use JET Transformation launch configurations. It
is also possible to invoke JET Transformations via API. To run a JET
transformation from an already-loaded EMF model (say that your EMF/GMF
generated editor has open), you can use:

Resource emfResource = ... ; // the EMF Resource containing the already
loaded model
Map additionalVars = new HashMap();
// do things like additionalVars.add("targetProject", "foo.bar"); to define
input variables to the JET transformation
JET2Platform.runTransform("..transform id..", emfResource, additionalVars,
progressMonitor);
Re: Using JET on xsd compliant xml [message #601319 is a reply to message #66299] Tue, 16 January 2007 16:04 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Rajesh:

You asked:
> How can we use JET to browse EMF editor created xml via ecore EMF api
> and generate java code ?

do the following:
1) Create a new EMFT JET Project. EMFT JET project names should be valid
plug-in names - something like: dump.my.emf.model
2) Open plugin.xml, switch to the 'Extensions' tab, expand the tree and
select 'transform'. Set the 'modelLoader' attribute to
'org.eclipse.jet.emf'.
3) Save and exit the Plug-in Manifest Editor.
4) Find a instance of the document created by your EMF-created editor.
Select it.
5a) If the file has an XML extension, right click, and click Run As > Input
for JET Transformation
5b) If the file does not have an XML extesino, right click, and chick Run As
> Run... Then select JET Transformation, and click the 'New' icon.
6) In the ID drop-down, select the name of the project created in 1). Click
Run.

Although you have written no code, the above should execute, and produce a
file dump.xml in the root of the project containing th input selected in 4).
Note that dump.xml may not be an exact replica of the input - it is the
input document as seen by JET's XPath engine.

You can enhance this JET transformation to create other files/folders or
projects by including appropriate <ws:file>, <ws:folder> and <ws:project>
tags in templates/main.jet.

Each ws:file tag requires you to create a new JET template that provides the
file contents.

Lastly, you do not have to use JET Transformation launch configurations. It
is also possible to invoke JET Transformations via API. To run a JET
transformation from an already-loaded EMF model (say that your EMF/GMF
generated editor has open), you can use:

Resource emfResource = ... ; // the EMF Resource containing the already
loaded model
Map additionalVars = new HashMap();
// do things like additionalVars.add("targetProject", "foo.bar"); to define
input variables to the JET transformation
JET2Platform.runTransform("..transform id..", emfResource, additionalVars,
progressMonitor);
Previous Topic:JET error
Next Topic:[Announce] EMFT EODM 0.8.0M4 is available
Goto Forum:
  


Current Time: Thu Feb 25 23:02:03 GMT 2021

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

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

Back to the top