Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XMLResource only persists one root object(XMLResource only persists one root object)
XMLResource only persists one root object [message #997436] Mon, 07 January 2013 13:59 Go to next message
Greg Babcock is currently offline Greg Babcock
Messages: 24
Registered: October 2012
Junior Member
I have a simple application where I store multiple root objects in a resource. This worked with XMIResource, but when I switched to a XMLResource to take advantage of its uniqueID feature, only the first root object gets persisted.

I realize that this is probably the result of an XML rule limiting a document to a single root, are there any ways around it without resorting to multiple files?
Re: XMLResource only persists one root object [message #997581 is a reply to message #997436] Tue, 08 January 2013 13:07 Go to previous messageGo to next message
Vlad Gheorghe is currently offline Vlad Gheorghe
Messages: 111
Registered: May 2011
Senior Member
Hi Greg,

XMIResource extends XMLResource, so it inherits the useUUID feature.

In order to activate it you have to specialize XMIResourceImpl and override useIDs() to return true.

As for persisting to XML there are more strict requirements on the ecore (which include having a single root object per file).

Regards
Vlad
Re: XMLResource only persists one root object [message #997653 is a reply to message #997436] Mon, 07 January 2013 14:09 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. Damus
Messages: 789
Registered: July 2009
Senior Member
Hi, Greg,

You can use XMIResource. It uses an <XMI> element at the root to
collect multiple objects; EMF elides it when loading.

HTH,

Christian


On 2013-01-07 13:59:34 +0000, Greg Babcock said:

> I have a simple application where I store multiple root objects in a
> resource. This worked with XMIResource, but when I switched to a
> XMLResource to take advantage of its uniqueID feature, only the first
> root object gets persisted.
> I realize that this is probably the result of an XML rule limiting a
> document to a single root, are there any ways around it without
> resorting to multiple files?
Re: XMLResource only persists one root object [message #997724 is a reply to message #997653] Tue, 08 January 2013 16:01 Go to previous message
Greg Babcock is currently offline Greg Babcock
Messages: 24
Registered: October 2012
Junior Member
Thank you.
Previous Topic:Copying contained objects
Next Topic:[xcore][xtend] ordering problem during clean build
Goto Forum:
  


Current Time: Sat Sep 20 04:07:07 GMT 2014

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

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