|
Re: XSD->Ecore Mapping for unbounded sequences [message #1017831 is a reply to message #1017771] |
Tue, 12 March 2013 16:02 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Ronan,
Comments below.
On 12/03/2013 3:04 PM, Ronan B wrote:
> Hi,
> I'm pretty sure this issue has been brought up before but I can't see
> any resolution. I have created an ecore model based on an XSD. The XSD
> uses a sequence which has maxOccurs="unbounded" to state two elements
> can appear together an unlimited number of times within another
> element. They must sit together in this order. For example:
>
> <xs:element name="Range">
> <xs:complexType>
> <xs:sequence minOccurs="0" maxOccurs="unbounded">
> <xs:element ref="min"/>
> <xs:element ref="max"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> However, this restriction seems to be lost upon converting to ecore as
> my out models have the min and max elements stuck together e.g.
> <range>
> <min/>
> <min/>
> <min/>
> <min/>
> <min/>
> <min/>
> <max/>
> <max/>
> <max/>
> <max/>
> </range>
>
> How can I give the ecore serializer a hint not to do this to my XML?
You'd need to add an annotation to the schema, i.e., add
ecore:featureMap="rangeElements", so that a feature map that records the
mixed order of the two different "min"/"max" features.
> I found a similar issue on the boards on in this link,
> http://www.google.se/#hl=sv&sclient=psy-ab&q=xsd+ecore+mapping&oq=xsd+ecore+mapping&gs_l=hp.3..0i30j0i8i30.1021542.1023930.9.1024139.9.9.0.0.0.1.255.1432.2j4j3.9.0...0.0...1c.1.5.psy-ab.MMHNdCZ2jhE&pbx=1&bav=on.2,or.r_qf.&bvm=bv.43287494,d.Yms&fp=ad4b0d7c9fcf90d4&biw=1680&bih=848
> (see section Multiplicity at the Sequence or Choice Level)
>
> I know I could fix the original schema to avoid this issue but I don't
> have this possibility open to me.
It can't be done without at least add an annotation...
>
> Any help is appreciated!
> Regards,
> Ronan
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03003 seconds