Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XMLResourceImpl not saving all objects in contents
XMLResourceImpl not saving all objects in contents [message #692838] Tue, 05 July 2011 10:31 Go to next message
Kat Sharp is currently offline Kat SharpFriend
Messages: 1
Registered: July 2011
Junior Member
Hi,

I have been using XMLResourceImpl to persist my model to disk.

I added some model elements to the resource by calling .getContents.add();

Only the model element I added first was getting saved.

I debugged into the code and noticed that in XMLSaveImpl - which XMLResourceImpl uses - has the following method which is called as part of a save:

protected Object writeTopObjects(List<? extends EObject> contents)
{
return writeTopObject(contents.get(0));
}

Where it discards all of the contents apart from the first. I can't find this documented anywhere - does anyone know if this is the intended behaviour or not? If not I'll raise a bug.

Thanks,
Kat

[Updated on: Tue, 05 July 2011 10:32]

Report message to a moderator

Re: XMLResourceImpl not saving all objects in contents [message #692850 is a reply to message #692838] Tue, 05 July 2011 10:51 Go to previous message
Cyril Jaquier is currently offline Cyril JaquierFriend
Messages: 80
Registered: July 2009
Member
Hi Kat,

It's intended. Use XmiResourceImpl. XMLResourceImpl can only have one
root object.

Regards,
Cyril


On 07/05/2011 12:31 PM, Kat Sharp wrote:
> Hi,
>
> I have been using XMLResourceImpl to persist my model to disk.
>
> I added some model elements to the resource by calling .getContents.add();
>
> Only the model element I added first was getting saved.
>
> I debugged into the code and noticed that in XMLSaveImpl - which
> XMLResourceImpl uses - has the following method which is called as part
> of a save:
>
> protected Object writeTopObjects(List<? extends EObject> contents)
> {
> return writeTopObject(contents.get(0));
> }
>
> Where it discards all of the contents apart from this first. I can't
> find this documented anywhere - does anyone know if this is the intended
> behaviour or not? If not I'll raise a bug.
>
> Thanks,
> Kat
Previous Topic:(no subject)
Next Topic:[cdo 4.0] Feature map problems
Goto Forum:
  


Current Time: Thu Apr 25 07:46:27 GMT 2024

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

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

Back to the top