Modeling a Choice Group [message #430344] |
Fri, 15 May 2009 17:23  |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03405 seconds