Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » XSD to Ecore - Enumeration Problem
XSD to Ecore - Enumeration Problem [message #594088] Fri, 22 June 2007 15:05
Andy Hoffman is currently offline Andy HoffmanFriend
Messages: 8
Registered: July 2009
Junior Member
Folks,

I'm working on upgrading our current EMF/SDO environment from EMF 2.1 to
2.2 (finally moving upwards to Eclipse 3.2 in a large devel group). We do
a large amount of model generation from XML schemas, but for some reason,
the code that is generated from EMF 2.2 is *NOT* compatible with the model
code generated from EMF 2.1. In particular, when I use XSD as source for
ecore/genmodel creation, some enumeration values in the XSD are coming out
DIFFERENTLY within the ecore literals under EMF 2.2 vs. EMF 2.1. For
example, I have an AccountType enumeration in XSD that looks like this:

<xs:simpleType name="AccountType">
<xs:restriction base="xs:string">
<xs:enumeration value="HRA"/>
<xs:enumeration value="HRA_ROLLOVER"/>
...
<xs:enumeration value="HRA_RETIREMENT"/>
</xs:restriction>
</xs:simpleType>

And when I run it through EMF 2.1 XSD ecore/genmodel generation, I get
mappings to literals that match the same names (from genmodel)...

<genEnums ecoreEnum="saeob.ecore#//AccountType">
<genEnumLiterals ecoreEnumLiteral="saeob.ecore#//AccountType/HRA"/>
<genEnumLiterals
ecoreEnumLiteral="saeob.ecore#//AccountType/HRA_ROLLOVER"/ >
...
<genEnumLiterals
ecoreEnumLiteral="saeob.ecore#//AccountType/HRA_RETIREMENT"/
</genEnums>

But when I run it through EMF 2.2 XSD ecore/genmodel generation, I get a
renaming of the literals, where the underscore characters are removed...

<genEnums ecoreEnum="saeob.ecore#//AccountType">
<genEnumLiterals ecoreEnumLiteral="saeob.ecore#//AccountType/HRA"/>
<genEnumLiterals
ecoreEnumLiteral="saeob.ecore#//AccountType/HRAROLLOVER"/>
...
<genEnumLiterals
ecoreEnumLiteral="saeob.ecore#//AccountType/HRARETIREMENT"/ >
</genEnums>

And thus, when the model code is generated, what WAS a public literal
object reference AccountType.HRA_ROLLOVER_LITERAL through EMF 2.1
(referenced within many parts of non-EMF/SDO codebase), is now
AccountType.HRAROLLOVER_LITERAL through EMF 2.2 (and obviously causes
compile issues with the rest of my codebase.

Also, not sure if this is related, but the *Package classes no longer seem
to be generated (scratching my head on that one) - I get the *Factory
classes by no *Package (???)

Is this simply a configuration issue on my end? Am I missing some
property/preference setting within EMF?
Previous Topic:How to create extensible EMF model (via FeatureMaps) based on multiple XSDs (with substituion groups
Next Topic:XSD to Ecore - Enumeration Problem
Goto Forum:
  


Current Time: Tue Dec 23 00:09:58 GMT 2014

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

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