Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » serialize ecore references into container
serialize ecore references into container [message #639674] Wed, 17 November 2010 12:34 Go to next message
Flo  is currently offline Flo Friend
Messages: 2
Registered: November 2010
Junior Member
Hi,

suppose I have this metamodel:

class Chair has a reference named "parts" of type "Part". Part is
superclass to classes Leg and Arm.

by default a model instance gets serialized to this:

<chair:Chair xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:chair="chair.de">
<parts xsi:type="chair:Arm"/>
<parts xsi:type="chair:Leg"/>
</chair:Chair>

What I would like is:

<Chair>
<Parts>
<Arm/>
<Leg/>
</Parts>
</Chair>

What is the way to go?

Best regards, thanks in advance,

FLO
Re: serialize ecore references into container [message #639715 is a reply to message #639674] Wed, 17 November 2010 14:58 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 26287
Registered: July 2009
Senior Member
Florian,

Please use the EMF newsgroup (eclipse.tools.emf) for future questions
about EMF. More comments below.

Florian Marienfeld wrote:
> Hi,
>
> suppose I have this metamodel:
>
> class Chair has a reference named "parts" of type "Part". Part is
> superclass to classes Leg and Arm.
>
> by default a model instance gets serialized to this:
>
> <chair:Chair xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:chair="chair.de">
> <parts xsi:type="chair:Arm"/>
> <parts xsi:type="chair:Leg"/>
> </chair:Chair>
>
> What I would like is:
>
> <Chair>
> <Parts>
> <Arm/>
> <Leg/>
> </Parts>
> </Chair>
>
> What is the way to go?
>
Best is to write a schema with substitution groups and follow the steps
outlined in http://ed-merks.blogspot.com/2007/12/winters-icy-grip.html
to avoid ending up with a horrible API.
> Best regards, thanks in advance,
>
> FLO
>
>
Previous Topic:Preserve attribute order in XSD to Ecore import
Next Topic:serialize ecore references into container
Goto Forum:
  


Current Time: Sun Dec 21 19:29:43 GMT 2014

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

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