Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Code Generation: Separating generic classes according to schema structure
EMF Code Generation: Separating generic classes according to schema structure [message #654898] Thu, 17 February 2011 14:23 Go to next message
Yves Grenier is currently offline Yves GrenierFriend
Messages: 4
Registered: July 2009
Junior Member
I am working on a project consisting of several XSD files... lets call them
the specific shema files. They all include a reference to another XSD
containing base (generic) elements definitions. When I create my genmodel
and code generate, all the classes end-up in the EMF project related to the
specific schema. I just dont want to end-up with several duplications of the
same classes.

I could generate the classes from the XSD which includes the generic
elements and then delete them from each other projects however there must be
a faster cleaner way?

Regards,

Yves
Re: EMF Code Generation: Separating generic classes according to schema structure [message #655643 is a reply to message #654898] Tue, 22 February 2011 06:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Yves,

Comments below.

Yves Grenier wrote:
> I am working on a project consisting of several XSD files... lets call them
> the specific shema files. They all include a reference to another XSD
> containing base (generic) elements definitions. When I create my genmodel
> and code generate, all the classes end-up in the EMF project related to the
> specific schema. I just dont want to end-up with several duplications of the
> same classes.
>
You should be able to generate the base model separately first and
reference it from the other models that reuse it.
> I could generate the classes from the XSD which includes the generic
> elements and then delete them from each other projects however there must be
> a faster cleaner way?
>
In the final page of the wizard, you ensure that you reuse the
GenPackage for the already-generated base model.
> Regards,
>
> Yves
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Code Generation: Separating generic classes according to schema structure [message #655769 is a reply to message #655643] Tue, 22 February 2011 15:14 Go to previous messageGo to next message
Yves Grenier is currently offline Yves GrenierFriend
Messages: 4
Registered: July 2009
Junior Member
Thanks for the info Ed. There seems to be a problem with this approach, the
Elipse documentation for the library example states the following:

<<In general, more than one package may be produced from a single schema if
it includes other schemas that declare different target namespaces. Select
the package for which you want to generate an EMF model -- in this case, the
only package, "org.eclipse.example.library". Click the "Finish" button.>>

However in my case, the same namespace is used in both the generic schema
and the specific ones. From the wizard, when I try to check the "Referenced
generator models" I added (the one containing the generic classes), the root
package at the top dissapers. It looks like I have to choose one or the
other... and if there is no package to generate the "finish" button is
greyed-out of course.

I searched inside the genmodel properties for something that would look like
a reference to a different genmodel however I could not find it.

Not sure what to do next.

Yves


"Ed Merks" <Ed.Merks@gmail.com> wrote in message
news:ijvju9$hoo$2@news.eclipse.org...
> Yves,
>
> Comments below.
>
> Yves Grenier wrote:
>> I am working on a project consisting of several XSD files... lets call
>> them the specific shema files. They all include a reference to another
>> XSD containing base (generic) elements definitions. When I create my
>> genmodel and code generate, all the classes end-up in the EMF project
>> related to the specific schema. I just dont want to end-up with several
>> duplications of the same classes.
>>
> You should be able to generate the base model separately first and
> reference it from the other models that reuse it.
>> I could generate the classes from the XSD which includes the generic
>> elements and then delete them from each other projects however there must
>> be a faster cleaner way?
>>
> In the final page of the wizard, you ensure that you reuse the GenPackage
> for the already-generated base model.
>> Regards,
>>
>> Yves
>>
>>
Re: EMF Code Generation: Separating generic classes according to schema structure [message #655877 is a reply to message #655769] Wed, 23 February 2011 00:40 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000709050101020408000304
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Yves,

Comments below.

Yves Grenier wrote:
> Thanks for the info Ed. There seems to be a problem with this approach, the
> Elipse documentation for the library example states the following:
>
> <<In general, more than one package may be produced from a single schema if
> it includes other schemas that declare different target namespaces. Select
> the package for which you want to generate an EMF model -- in this case, the
> only package, "org.eclipse.example.library". Click the "Finish" button.>>
>
> However in my case, the same namespace is used in both the generic schema
> and the specific ones.
There's only one package then and you can't split it.
> From the wizard, when I try to check the "Referenced
> generator models" I added (the one containing the generic classes), the root
> package at the top dissapers. It looks like I have to choose one or the
> other... and if there is no package to generate the "finish" button is
> greyed-out of course.
>
> I searched inside the genmodel properties for something that would look like
> a reference to a different genmodel however I could not find it.
>
You can only do that if you have multiple packages with different
namespaces.
> Not sure what to do next.
>
> Yves
>
>
> "Ed Merks" <Ed.Merks@gmail.com> wrote in message
> news:ijvju9$hoo$2@news.eclipse.org...
>
>> Yves,
>>
>> Comments below.
>>
>> Yves Grenier wrote:
>>
>>> I am working on a project consisting of several XSD files... lets call
>>> them the specific shema files. They all include a reference to another
>>> XSD containing base (generic) elements definitions. When I create my
>>> genmodel and code generate, all the classes end-up in the EMF project
>>> related to the specific schema. I just dont want to end-up with several
>>> duplications of the same classes.
>>>
>>>
>> You should be able to generate the base model separately first and
>> reference it from the other models that reuse it.
>>
>>> I could generate the classes from the XSD which includes the generic
>>> elements and then delete them from each other projects however there must
>>> be a faster cleaner way?
>>>
>>>
>> In the final page of the wizard, you ensure that you reuse the GenPackage
>> for the already-generated base model.
>>
>>> Regards,
>>>
>>> Yves
>>>
>>>
>>>
>
>
>

--------------000709050101020408000304
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Yves,<br>
<br>
Comments below.<br>
<br>
Yves Grenier wrote:
<blockquote cite="mid:ik0jg2$93o$1@news.eclipse.org" type="cite">
<pre wrap="">Thanks for the info Ed. There seems to be a problem with this approach, the
Elipse documentation for the library example states the following:

&lt;&lt;In general, more than one package may be produced from a single schema if
it includes other schemas that declare different target namespaces. Select
the package for which you want to generate an EMF model -- in this case, the
only package, "org.eclipse.example.library". Click the "Finish" button.&gt;&gt;

However in my case, the same namespace is used in both the generic schema
and the specific ones.</pre>
</blockquote>
There's only one package then and you can't split it.<br>
<blockquote cite="mid:ik0jg2$93o$1@news.eclipse.org" type="cite">
<pre wrap=""> From the wizard, when I try to check the "Referenced
generator models" I added (the one containing the generic classes), the root
package at the top dissapers. It looks like I have to choose one or the
other... and if there is no package to generate the "finish" button is
greyed-out of course.

I searched inside the genmodel properties for something that would look like
a reference to a different genmodel however I could not find it.
</pre>
</blockquote>
You can only do that if you have multiple packages with different
namespaces.<br>
<blockquote cite="mid:ik0jg2$93o$1@news.eclipse.org" type="cite">
<pre wrap="">
Not sure what to do next.

Yves


"Ed Merks" <a class="moz-txt-link-rfc2396E" href="mailto:Ed.Merks@gmail.com">&lt;Ed.Merks@gmail.com&gt;</a> wrote in message
<a class="moz-txt-link-freetext" href="news:ijvju9$hoo$2@news.eclipse.org">news:ijvju9$hoo$2@news.eclipse.org</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Yves,

Comments below.

Yves Grenier wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I am working on a project consisting of several XSD files... lets call
them the specific shema files. They all include a reference to another
XSD containing base (generic) elements definitions. When I create my
genmodel and code generate, all the classes end-up in the EMF project
related to the specific schema. I just dont want to end-up with several
duplications of the same classes.

</pre>
</blockquote>
<pre wrap="">You should be able to generate the base model separately first and
reference it from the other models that reuse it.
</pre>
<blockquote type="cite">
<pre wrap="">I could generate the classes from the XSD which includes the generic
elements and then delete them from each other projects however there must
be a faster cleaner way?

</pre>
</blockquote>
<pre wrap="">In the final page of the wizard, you ensure that you reuse the GenPackage
for the already-generated base model.
</pre>
<blockquote type="cite">
<pre wrap="">Regards,

Yves


</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->

</pre>
</blockquote>
</body>
</html>

--------------000709050101020408000304--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:In memory Ecore to XSD
Next Topic:invalid QName for EMF but not for javax.xml.namespace
Goto Forum:
  


Current Time: Thu Apr 25 08:13:34 GMT 2024

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

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

Back to the top