Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ecore vs xsd generated package names
ecore vs xsd generated package names [message #403531] Tue, 12 September 2006 17:23 Go to next message
Daniel Mahler is currently offline Daniel MahlerFriend
Messages: 53
Registered: July 2009
Member
I have a project generated from XSD.
after making changes to the genmodel
I wanted to regenerate a default genmodel.
I tried regenerating it from the ecore
However, the code generated from the (xsd generated) ecore
uses different package names to the genmodel genmodel generated directly.
The genmodel generated in one step uses package names that reflect the whole
uris including the expanded namespace,
while packages generated in 2 steps have packagenames that seem to relflect
unexpanded name of the namespace, ie if in the ecore there is

<ecore:EPackage
....
nsURI="http://www.rightscom.com/ns/ccs" nsPrefix="ccs">

I get a package "com.rightscom.ns.ccs" if I generate the genmodel directly from
the XSD, and just "ccs" if I geneate the genmodel from the intermmediate ecore.
While you can edit the new genmodel, it seems odd that the two genmodels are not
equivalent to begin with. Is this a bug, is there a reason for the difference?

thanks
Daniel
Re: ecore vs xsd generated package names [message #403533 is a reply to message #403531] Tue, 12 September 2006 17:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Daniel,

When importing from XSD, the GenPackage's Base Package property as well
as the GenPackage's Prefix property are populated from the namespace.
This information is not directly available in the Ecore model itself,
which includes only the final segment of the EPackage's name. When
reloading a model, these settings are preserved. So if you create a
GenModel directly from the .ecore, you'll need to set these to match
what you want, or you can copy the .genmodel and when you reload the
copy, switch to use the .ecore directly. No attempt is made to use the
nsURI to determine a fully qualified package name for the Ecore case
since if you look at the nsURIs typically used by the EMF models, they
wouldn't produce the desired result anyway, e.g., a schema with target
namespace http://www.eclipse.org/emf/2002/Ecore wouldn't produce
org.eclipse.emf as the base package, and the EPackage name itself could
contradict the qualified name produced from the namespace.


dmahler@gmail.com wrote:
> I have a project generated from XSD.
> after making changes to the genmodel
> I wanted to regenerate a default genmodel.
> I tried regenerating it from the ecore
> However, the code generated from the (xsd generated) ecore
> uses different package names to the genmodel genmodel generated directly.
> The genmodel generated in one step uses package names that reflect the whole
> uris including the expanded namespace,
> while packages generated in 2 steps have packagenames that seem to relflect
> unexpanded name of the namespace, ie if in the ecore there is
>
> <ecore:EPackage
> ....
> nsURI="http://www.rightscom.com/ns/ccs" nsPrefix="ccs">
>
> I get a package "com.rightscom.ns.ccs" if I generate the genmodel directly from
> the XSD, and just "ccs" if I geneate the genmodel from the intermmediate ecore.
> While you can edit the new genmodel, it seems odd that the two genmodels are not
> equivalent to begin with. Is this a bug, is there a reason for the difference?
>
> thanks
> Daniel
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[newbie]Persist classes in a DataBase
Next Topic:EPackage behaving strangely
Goto Forum:
  


Current Time: Fri Apr 19 02:49:11 GMT 2024

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

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

Back to the top