Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ECore generated from XSD includes Type suffix in class names
ECore generated from XSD includes Type suffix in class names [message #1478390] Tue, 18 November 2014 16:47 Go to next message
maria  finkelstein is currently offline maria finkelsteinFriend
Messages: 19
Registered: December 2011
Location: New York, NY
Junior Member
Hello,

When I generate ecore from my schema all generated elements include Type suffix in its names. For example, NameType, NameType1, NameType2. Does anybody know why these are being generated like this?

Thanks!
Re: ECore generated from XSD includes Type suffix in class names [message #1478401 is a reply to message #1478390] Tue, 18 November 2014 16:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Miria,

How did you generate the schema? Using Export Model...? If not, that
would be the thing to try instead.

On 18/11/2014 5:47 PM, maria finkelstein wrote:
> Hello,
>
> When I generate ecore from my schema all generated elements include
> Type suffix in its names. For example, NameType, NameType1, NameType2.
> Does anybody know why these are being generated like this?
>
> Thanks!


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: ECore generated from XSD includes Type suffix in class names [message #1478444 is a reply to message #1478401] Tue, 18 November 2014 17:41 Go to previous messageGo to next message
maria  finkelstein is currently offline maria finkelsteinFriend
Messages: 19
Registered: December 2011
Location: New York, NY
Junior Member
Ed,
I generated my schema manually out of xml.
then i tried to create a genmodel out of schema and there is where is looks messy.
thanks
maria
Re: ECore generated from XSD includes Type suffix in class names [message #1479086 is a reply to message #1478444] Wed, 19 November 2014 06:24 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Maria,

Sorry, I misread your question as going in the other direction Ecore ->
XSD...

For XSD -> Ecore there are several issues. Firstly, the name of each
ENamedElement must be a well formed Java identifier, but the name of a
named element in XML Schema must be an NCName. NCName allows characters
that are not valid as a Java identifier. Furthermore, the various types
of ENamedElements are expected to follow Java standard naming
conventions, i.e., camel case, where types should start with an upper
case letter and features should start with a lower case letter. The
mapping processes ensures the result is in this form, so the names are
mangled. The original XML names are recorded as annotations. The
second issue is that XML Schema allows anonymous types, but Ecore has
not such concept, so anonymous complex and simple types must be assigned
a name, which is generally achieved by taking the name of the container
and appending "Type" to it. Then because many elements with the same
name can have different anonymous types, this approach leads to
collisions, which also isn't allowed, i.e., the classifier names in a
package and the features of a class must each be unique. That's where
numbers like 1, 2, and 3 come from.

All these names can be control with ecore:name annotations in the schema
(or you could change then in your Ecore manually).


On 18/11/2014 6:41 PM, maria finkelstein wrote:
> Ed,
> I generated my schema manually out of xml. then i tried to create a
> genmodel out of schema and there is where is looks messy.
> thanks maria


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Extend Metadata Tutorial
Next Topic:[CDO] CDO Server unknown DB adapter hsqldb
Goto Forum:
  


Current Time: Thu Mar 28 08:48:41 GMT 2024

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

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

Back to the top