Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF] Serialization with jackson in XMI file
[EMF] Serialization with jackson in XMI file [message #1768331] Mon, 17 July 2017 15:03 Go to next message
Cyril Chevé is currently offline Cyril ChevéFriend
Messages: 11
Registered: October 2016
Junior Member

I am trying to save EObjects in an XMI file. It works fine with simple EObjects.
But I have some EObjects that are more specific.

I have one EClass "TestModel" that has only one attribute, tagged as ID and of type "TestType".
The EDataType "TestType" has also only one attribute. I use jackson to serialize and deserialize "TestType". So, the serialized value of the EDataType is like : {"attribute":"value"}

This EObject is correctly put in the XMI file :
<model:TestModel testAttribute="{&quot;attribute&quot;:&quot;value&quot;}"/>
The character '"' (quote) is replaced by : &quot;
The EObject is also correctly loaded from the XMI file.

But when I create a reference between this EObject and another EObject ("ReferenceToTestModel"), I have the following result :
<model:ReferenceToTestModel relation="{"attribute":"value"}"/>
The character '"' (quote) is not replaced in the XMI file. The format of the file is not correct anymore.

I have added the following options when saving the EObjects in the XMI file :
Doing this has solved the issue but I would like to be sure that this is the correct solution.

Thanks in advance.

Re: [EMF] Serialization with jackson in XMI file [message #1768353 is a reply to message #1768331] Mon, 17 July 2017 18:54 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30813
Registered: July 2009
Senior Member
Yes, org.eclipse.emf.ecore.xmi.XMLResource.OPTION_SKIP_ESCAPE_URI mapped to Boolean.FALSE will escape special characters in the URIs (though it's best to avoid that in the first place).
Previous Topic:[CDO] Reset repository content to a previous commit
Next Topic:[CDO] Refresh cdoPermission
Goto Forum:

Current Time: Fri Jan 24 11:23:06 GMT 2020

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

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

Back to the top