Skip to main content


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 17:01 Go to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
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 17:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
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.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF and XML: list serialization [message #1081438 is a reply to message #1081007] Wed, 07 August 2013 08:21 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
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 08:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
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.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF and XML: list serialization [message #1081484 is a reply to message #1081447] Wed, 07 August 2013 09:30 Go to previous messageGo to next message
Tommaso De Sica is currently offline Tommaso De SicaFriend
Messages: 131
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 10:19 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Xcore] Using the same field name in subclasses
Next Topic:Accessing References inside model element
Goto Forum:
  


Current Time: Fri Apr 19 05:37:51 GMT 2024

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

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

Back to the top