DZone Forums
Go Back   DZone Forums > Community > Tools & IDEs > Eclipse
Reload this Page EMF - Serialization Issue related to Namespace
Notices
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Jun 2010
Default EMF - Serialization Issue related to Namespace - 06-25-2010, 12:29 AM

We have an ecore model - which is representation of simple data model. I am trying to serialize this model using the following code.

ResourceSet resourceSet = new ResourceSetImpl();
// Register XML resource factory resourceSet.getResourceFactoryRegistry().getExtens ionToFactoryMap()
.put("xmi", new XMIResourceFactoryImpl());
Resource resource = resourceSet.createResource(URI
.createFileURI(outputFile));
// add the root object to the resource
resource.getContents().add((EObject) obj);
resource.save(null);

The model contains A, B, C has three classifiers. All of them have structural features of simple types (String) - id, name etc. They have references too.
A has a reference 'b' which is of type B and 'c' which is of type C. I have set the namespace as "myexample.com" and prefix - test

All reference - the containment is set to be 'true'. Now when i serialize this xmi (which is containing A) - the xmi that gets written is as follows

<test:A xmi:version="1" xmlns:xmi="" xmlns:test="myexample.com">
<b id="1" name="testb"/>
<c id="1" name="testc"/>
</test:A>

The issue is - only the top element seems to have the namespace prefix, where as all the other elements don't have. Also the default namespace is not showing up in this XMI. The issue is when i consume this xmi in another application as an XML - then element b and c - do not seem to have any namespace associated with it?

How can i get - b and c also to have test prefix (or) a default namespace definition on the xmi as "myexample.com"??
Reply With Quote
Reply

Tags
emf, namespace, serialization

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LTK Refactoring - Mandatory/Related Changes brunoconde Eclipse 0 06-14-2010 04:29 AM
LTK Refactoring - Mandatory/Related Changes brunoconde Eclipse 0 06-14-2010 04:26 AM
EMF Serialization of Objects ugurkocak1980 Eclipse 1 05-12-2010 07:02 AM
Need a help related to actionSets suma_eclipse Eclipse 2 02-13-2008 05:57 AM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com