Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF and XML: list serialization
EMF and XML: list serialization [message #1080994] Tue, 06 August 2013 13:01 Go to next message
Tommaso De Sica is currently offline Tommaso De Sica
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

I notice this behavior when I try to persist an EList into XML file:
if ALL contents are in the same resource, I'll see something like:
<myClass myList="uuid1 uuid2" />


if one or more contents are from antoher resource, I'll see:
<myClass>
<myList href="#uuid1" />
<myList href="#uuid1" />
<myList href="myprotocoluri/#uuid3" />
</myClass>


Is there an option to serialize lists always with node element and href?

Very thanks.
Re: EMF and XML: list serialization [message #1081007 is a reply to message #1080994] Tue, 06 August 2013 13:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26000
Registered: July 2009
Senior Member
Try
org.eclipse.emf.ecore.xmi.XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE.

On 06/08/2013 7:01 PM, Tommaso De Sica wrote:
> I notice this behavior when I try to persist an EList into XML file:
> if ALL contents are in the same resource, I'll see something like:
>
> <myClass myList="uuid1 uuid2" />
>
> if one or more contents are from antoher resource, I'll see:
>
> <myClass>
> <myList href="#uuid1" />
> <myList href="#uuid1" />
> <myList href="myprotocoluri/#uuid3" />
> </myClass>
>
> Is there an option to serialize lists always with node element and href?
>
> Very thanks.
Re: EMF and XML: list serialization [message #1081438 is a reply to message #1081007] Wed, 07 August 2013 04:21 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De Sica
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

Thanks Ed Merks for fast reply.

I've tried to use that option but the result was this:
<myClass myList="#uuid1 #uuid2" />


Now I'm debugging XML serializer.
Re: EMF and XML: list serialization [message #1081447 is a reply to message #1081438] Wed, 07 August 2013 04:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26000
Registered: July 2009
Senior Member
Tommaso,

Yes, I would expect that. In general it will use QName/URI pairs (where
the QName is optional and is needed only if the feature's type is
abstract in which case it must specify the non-abstract type of the
proxy that will be created).

On 07/08/2013 10:21 AM, Tommaso De Sica wrote:
> Thanks Ed Merks for fast reply.
>
> I've tried to use that option but the result was this:
> <myClass myList="#uuid1 #uuid2" />
>
> Now I'm debugging XML serializer.
Re: EMF and XML: list serialization [message #1081484 is a reply to message #1081447] Wed, 07 August 2013 05:30 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De Sica
Messages: 128
Registered: March 2012
Location: Italy
Senior Member

Ed Merks wrote on Wed, 07 August 2013 10:36
Tommaso,

Yes, I would expect that. In general it will use QName/URI pairs (where
the QName is optional and is needed only if the feature's type is
abstract in which case it must specify the non-abstract type of the
proxy that will be created).


I expected something like this, so the only solution that I could find is override
saveFeatures() of XMLSaveImpl to exclude case "SAME_DOC".

Thanks Merks for your time, but do you never go on holiday? Smile
Re: EMF and XML: list serialization [message #1081518 is a reply to message #1081484] Wed, 07 August 2013 06:19 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26000
Registered: July 2009
Senior Member
Tommaso,

Comments below.

On 07/08/2013 11:30 AM, Tommaso De Sica wrote:
> Ed Merks wrote on Wed, 07 August 2013 10:36
>> Tommaso,
>>
>> Yes, I would expect that. In general it will use QName/URI pairs
>> (where the QName is optional and is needed only if the feature's type
>> is abstract in which case it must specify the non-abstract type of
>> the proxy that will be created).
>
>
> I expected something like this, so the only solution that I could find
> is override
> saveFeatures() of XMLSaveImpl to exclude case "SAME_DOC".
You have to be careful with that... I'm not sure it's okay to call that
(without additional specialization) if there really are cross document
references...
>
> Thanks Merks for your time, but do you never go on holiday? :)
Not often enough without my computer. :-P
Previous Topic:[Xcore] Using the same field name in subclasses
Next Topic:Accessing References inside model element
Goto Forum:
  


Current Time: Sat Aug 23 11:37:18 EDT 2014

Powered by FUDForum. Page generated in 0.02110 seconds