Home » Modeling » EMF » Empy many ereference is not serialized with empty content
| |
Re: Empy many ereference is not serialized with empty content [message #719751 is a reply to message #719728] |
Sun, 28 August 2011 18:41 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
Hmm, I am now calling clear on the elist (EcoreList$Dynamic) but still the xml does not show an empty books tag. The
efeature has unsettable=false.
Is there another way to achieve this, or am I doing something wrong?
gr. Martin
On 08/28/2011 06:29 PM, Ed Merks wrote:
> Martin,
>
> Multi-valued features can be made unsettable. To change the list's default empty state to the set-to-empty state, you
> have to call clear() on it.
>
>
>
> On 28/08/2011 5:37 AM, Martin Taal wrote:
>> Hi,
>> Using the Library example, if I serialize a writer without books then I get xml without the books attribute:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <library:Writer xmlns:library="http://www.eclipse.org/emf/texo/test/model/samples/library" db_Id="3"
>> name="1314534528278"/>
>>
>> is there a way to force an empty books attribute in the xml? Does the same apply to EAttributes or non-many EFeatures?
>>
>> My guess it is somehow related to unsettable, correct?
>>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Re: Empy many ereference is not serialized with empty content [message #719752 is a reply to message #719751] |
Sun, 28 August 2011 19:04 |
Ed Merks Messages: 33147 Registered: July 2009 |
Senior Member |
|
|
Martin,
Looking at XMLSaveImpl, it will only support this if the feature can be
saved as an XML attribute. Does it get to this logic in saveFeatures?
case OBJECT_CONTAIN_MANY_UNSETTABLE:
case DATATYPE_MANY:
{
if (isEmpty(o, f))
{
saveManyEmpty(o, f);
continue LOOP;
}
break;
}
On 28/08/2011 11:41 AM, Martin Taal wrote:
> Hi Ed,
> Hmm, I am now calling clear on the elist (EcoreList$Dynamic) but still
> the xml does not show an empty books tag. The efeature has
> unsettable=false.
>
> Is there another way to achieve this, or am I doing something wrong?
>
> gr. Martin
>
> On 08/28/2011 06:29 PM, Ed Merks wrote:
>> Martin,
>>
>> Multi-valued features can be made unsettable. To change the list's
>> default empty state to the set-to-empty state, you
>> have to call clear() on it.
>>
>>
>>
>> On 28/08/2011 5:37 AM, Martin Taal wrote:
>>> Hi,
>>> Using the Library example, if I serialize a writer without books
>>> then I get xml without the books attribute:
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <library:Writer
>>> xmlns:library="http://www.eclipse.org/emf/texo/test/model/samples/library"
>>> db_Id="3"
>>> name="1314534528278"/>
>>>
>>> is there a way to force an empty books attribute in the xml? Does
>>> the same apply to EAttributes or non-many EFeatures?
>>>
>>> My guess it is somehow related to unsettable, correct?
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Empy many ereference is not serialized with empty content [message #719755 is a reply to message #719752] |
Sun, 28 August 2011 19:40 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Yes for datatypes, I am looking at ereferences, but the code ends up here:
protected void saveEObjectMany(EObject o, EStructuralFeature f)
{
@SuppressWarnings("unchecked") InternalEList<? extends EObject> values = (InternalEList<? extends
EObject>)helper.getValue(o, f);
if (!values.isEmpty())
.....
}
}
The xml is only created if the values are not empty.
I have to find another solution.
gr. Martin
On 08/28/2011 09:04 PM, Ed Merks wrote:
> Martin,
>
> Looking at XMLSaveImpl, it will only support this if the feature can be saved as an XML attribute. Does it get to this
> logic in saveFeatures?
>
> case OBJECT_CONTAIN_MANY_UNSETTABLE:
> case DATATYPE_MANY:
> {
> if (isEmpty(o, f))
> {
> saveManyEmpty(o, f);
> continue LOOP;
> }
> break;
> }
>
>
> On 28/08/2011 11:41 AM, Martin Taal wrote:
>> Hi Ed,
>> Hmm, I am now calling clear on the elist (EcoreList$Dynamic) but still the xml does not show an empty books tag. The
>> efeature has unsettable=false.
>>
>> Is there another way to achieve this, or am I doing something wrong?
>>
>> gr. Martin
>>
>> On 08/28/2011 06:29 PM, Ed Merks wrote:
>>> Martin,
>>>
>>> Multi-valued features can be made unsettable. To change the list's default empty state to the set-to-empty state, you
>>> have to call clear() on it.
>>>
>>>
>>>
>>> On 28/08/2011 5:37 AM, Martin Taal wrote:
>>>> Hi,
>>>> Using the Library example, if I serialize a writer without books then I get xml without the books attribute:
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <library:Writer xmlns:library="http://www.eclipse.org/emf/texo/test/model/samples/library" db_Id="3"
>>>> name="1314534528278"/>
>>>>
>>>> is there a way to force an empty books attribute in the xml? Does the same apply to EAttributes or non-many EFeatures?
>>>>
>>>> My guess it is somehow related to unsettable, correct?
>>>>
>>
>>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
Goto Forum:
Current Time: Wed May 15 02:50:14 GMT 2024
Powered by FUDForum. Page generated in 0.04272 seconds
|