Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Modeling a Choice Group
Modeling a Choice Group [message #430344] Fri, 15 May 2009 21:23 Go to next message
John T.E. Timm is currently offline John T.E. TimmFriend
Messages: 161
Registered: July 2009
Senior Member
I am modeling a what is essentially choice group using UML and then
converting to Ecore. Essentially, I am doing it the same way that the EMF
XSD import does it where:

<xsd:complexType name="Supplier">
<xsd:sequence>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="preferredOrders" type="PurchaseOrder"/>
<xsd:element name="standardOrders" type="PurchaseOrder"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>

translates an EClass "Supplier" to two EReferences [PurchaseOrder]
"preferredOrders" and "standardOrders" with cardinality [0..*]. I have a
requirement to serialize them into two different XML elements
preferredOrders and standardOrders. However, I would like the
serialization order to follow how the object was constructed. So I guess I
am in need of something like an "ordered" choice group. :) Anyways, I
read "EMF FeatureMaps" and I see how to use a FeatureMap to represent all
"orders" and also to distringuish between the two types. in the client
code, if i add one preferred order followed by one standardOrder followed
by one preferred order i want something like this:

<preferredOrder>...</preferredOrder>
<standardOrder>...</standardOrder>
<preferredOrder>...</standardOrder>

Where would I begin to customize the serialization code to make something
like this happen?

Thanks,

JT
Re: Modeling a Choice Group [message #430345 is a reply to message #430344] Sat, 16 May 2009 06:25 Go to previous message
John T.E. Timm is currently offline John T.E. TimmFriend
Messages: 161
Registered: July 2009
Senior Member
I played around with FeatureMaps and the PO example and found that feature
maps to in fact respect order. This should work well for my particular
appllication.

Thanks,

JT
Previous Topic:Deserialization of multiple EClasses with the same XML name
Next Topic:[CDO] AuditSupport of MappingStrategy and Store does not match
Goto Forum:
  


Current Time: Thu Sep 19 18:40:21 GMT 2024

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

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

Back to the top