Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Serializing and deserializing EPackages
Serializing and deserializing EPackages [message #418343] Mon, 14 April 2008 09:07 Go to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020207050502040900020705
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I have a local package registry in a resource set and I need to
serialize some packages to an XMI string. Simply adding the EPackage
instances to XMIResources in a separate ResourceSet doesn't seem to do
the trick. References between the packages are serialized like:

<?xml version="1.0" encoding="ASCII"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model2"
nsURI="http://www.eclipse.org/emf/CDO/tests/model2/1.0.0" nsPrefix="model2">
<eClassifiers xsi:type="ecore:EClass" name="SpecialPurchaseOrder">
<eSuperTypes href=_*"../model1/1.0.0#//PurchaseOrder"*_/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="discountCode">
<eType xsi:type="ecore:EDataType"
href="../../../2002/Ecore#//EString"/>
</eStructuralFeatures>
</eClassifiers>
</ecore:EPackage>

Any hints are greatly appreciated

Cheers
/Eike




--------------020207050502040900020705
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I have a local package registry in a resource set and I need to
serialize some packages to an XMI string. Simply adding the EPackage
instances to XMIResources in a separate ResourceSet doesn't seem to do
the trick. References between the packages are serialized like:<br>
<br>
&lt;?xml version="1.0" encoding="ASCII"?&gt;<br>
&lt;ecore:EPackage xmi:version="2.0" xmlns:xmi=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/XMI">"http://www.omg.org/XMI"</a>
xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:ecore=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a> name="model2"
nsURI=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/CDO/tests/model2/1.0.0">"http://www.eclipse.org/emf/CDO/tests/model2/1.0.0"</a>
nsPrefix="model2"&gt;<br>


Re: Serializing and deserializing EPackages [message #418347 is a reply to message #418343] Mon, 14 April 2008 11:01 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060004060409040301060706
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Eike,

Comments below.

Eike Stepper wrote:
> Hi,
>
> I have a local package registry in a resource set and I need to
> serialize some packages to an XMI string.
Can you do ePackage.eResource().save(System.out, null)?
> Simply adding the EPackage instances to XMIResources in a separate
> ResourceSet doesn't seem to do the trick. References between the
> packages are serialized like:
>
> <?xml version="1.0" encoding="ASCII"?>
> <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="model2"
> nsURI="http://www.eclipse.org/emf/CDO/tests/model2/1.0.0"
> nsPrefix="model2">
> <eClassifiers xsi:type="ecore:EClass" name="SpecialPurchaseOrder">
> <eSuperTypes href=_*"../model1/1.0.0#//PurchaseOrder"*_/>
There's nothing wrong with that is there?
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="discountCode">
> <eType xsi:type="ecore:EDataType"
> href="../../../2002/Ecore#//EString"/>
I wonder what the URI of the resource from which this was saved was?
All references will be made relative to that URI. Note that you can use
OPTION_URI_HANDLER to control how and whether URIs are made relative...
> </eStructuralFeatures>
> </eClassifiers>
> </ecore:EPackage>
>
> Any hints are greatly appreciated
>
> Cheers
> /Eike
>
>
>


--------------060004060409040301060706
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Eike,<br>
<br>
Comments below.<br>
<br>
Eike Stepper wrote:
<blockquote cite="mid:ftv6t9$78h$1@build.eclipse.org" type="cite">Hi,<br>
<br>
I have a local package registry in a resource set and I need to
serialize some packages to an XMI string. </blockquote>
Can you do ePackage.eResource().save(System.out, null)?<br>
<blockquote cite="mid:ftv6t9$78h$1@build.eclipse.org" type="cite">Simply
adding the EPackage
instances to XMIResources in a separate ResourceSet doesn't seem to do
the trick. References between the packages are serialized like:<br>
<br>
&lt;?xml version="1.0" encoding="ASCII"?&gt;<br>
&lt;ecore:EPackage xmi:version="2.0" xmlns:xmi=<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E" href="http://www.omg.org/XMI">"http://www.omg.org/XMI"</a>
xmlns:xsi=<a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:ecore=<a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="http://www.eclipse.org/emf/2002/Ecore">"http://www.eclipse.org/emf/2002/Ecore"</a>
name="model2"
nsURI=<a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="http://www.eclipse.org/emf/CDO/tests/model2/1.0.0">"http://www.eclipse.org/emf/CDO/tests/model2/1.0.0"</a>
nsPrefix="model2"&gt;<br>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Eclipse 3.4/emf 2.4
Next Topic:Processing instructions from emf model
Goto Forum:
  


Current Time: Fri Apr 26 12:15:27 GMT 2024

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

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

Back to the top