|Re: ecore vs xsd generated package names [message #403533 is a reply to message #403531]
||Tue, 12 September 2006 17:41
| Ed Merks
Registered: July 2009
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.
> 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
> 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?
Powered by FUDForum
. Page generated in 0.01676 seconds