|
|
|
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 |
Ed Merks Messages: 33218 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/
|
|
|
Powered by
FUDForum. Page generated in 0.07549 seconds