Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Root element changed after saving model
Root element changed after saving model [message #1273777] Thu, 20 March 2014 14:25 Go to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
I have a model with multiple roots, as such whenever I create file with specific root DocumentRoot is loaded in the viewer. To work around this I've added

XMLResource.getDefaultLoadOptions().put(XMLResource.OPTION_SUPPRESS_DOCUMENT_ROOT, Boolean.TRUE);

to suppress loading of DocumentRoot. This works however my root element is changed after saving the model. Here is an example:

Model initial load
<?xml version="1.0" encoding="UTF-8"?>
<repository:rInlet xmlns:repository="http://my.com/xml/repository"/>


After save
<?xml version="1.0" encoding="UTF-8"?>
<repository:Inlet xmlns:repository="http://my.com/xml/repository"/>
  <ListenerRef/>
</repository:Inlet>


As you can see root element changed from rInlet to Inlet. At first I thought it was perhaps my changes upon model that causes this - I am using EMF Parsley, but even stock EMF editors do the same thing. Any ideas what am I doing wrong?

Thanks,
Alex
Re: Root element changed after saving model [message #1273817 is a reply to message #1273777] Thu, 20 March 2014 15:30 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Have you tried adding
XMLResource.getDefaultSaveOptions().put(XMLResource.OPTION_ELEMENT_HANDLER, new ElementHandlerImpl(false));
to you factory?
Re: Root element changed after saving model [message #1273826 is a reply to message #1273817] Thu, 20 March 2014 15:47 Go to previous message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
Leonid Ripeynih wrote on Thu, 20 March 2014 11:30
Have you tried adding
XMLResource.getDefaultSaveOptions().put(XMLResource.OPTION_ELEMENT_HANDLER, new ElementHandlerImpl(false));
to you factory?


Thanks Leonid, this solved the problem. Documentation makes sense.
Previous Topic:DragAndDropCommand move objects between different owners
Next Topic:Editing maps in property sheets
Goto Forum:
  


Current Time: Sat Apr 20 11:00:31 GMT 2024

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

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

Back to the top