Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Loading EMF model instances with different xml namespace prefix
Loading EMF model instances with different xml namespace prefix [message #416073] Thu, 17 January 2008 08:39 Go to next message
Eclipse UserFriend
Originally posted by: Burkhard.Weber.sick.de

Hello,

I generated some ecore models based on a given set of xsd files.
Creating instances of the ecore model with the generated editor plugin
worked fine. The serialization of the instances in xml contains the xml
namespace prefix strings I defined for the ecore models in the property NS
prefix.

If I try to load an xml instance of the given model, created by someone
else who used different xml namespace prefix strings, the generated editor
plugin could not load the resource.

What can I do, to load such resources in emf?

Thanks for your help!
Re: Loading EMF model instances with different xml namespace prefix [message #416077 is a reply to message #416073] Thu, 17 January 2008 09:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010603040306000703040905
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Burkhard,

EMF doesn't care about the actual string used for the prefix, only about
the namespace that's bound to the arbitrary prefix. So it sounds to me
like the model created by someone else is using a different namespace.
It's possible to register the same EPackage against multiple
namespaces. If you look in the plugin.xml, you'll see where your
package is registered. UML registers the same package for both its
older namespace and its current namespace:

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://www.eclipse.org/uml2/2.0.0/UML"
class = "org.eclipse.uml2.uml.UMLPackage" />
</extension>

<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://www.eclipse.org/uml2/2.1.0/UML"
class = "org.eclipse.uml2.uml.UMLPackage"
genModel = "model/UML.genmodel" />
</extension>

Note that you should register the genModel only for the actual namespace....


Burkhard wrote:
> Hello,
>
> I generated some ecore models based on a given set of xsd files.
> Creating instances of the ecore model with the generated editor plugin
> worked fine. The serialization of the instances in xml contains the
> xml namespace prefix strings I defined for the ecore models in the
> property NS prefix.
> If I try to load an xml instance of the given model, created by
> someone else who used different xml namespace prefix strings, the
> generated editor plugin could not load the resource.
> What can I do, to load such resources in emf?
>
> Thanks for your help!
>


--------------010603040306000703040905
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">
Burkhard,<br>
<br>
EMF doesn't care about the actual string used for the prefix, only
about the namespace that's bound to the arbitrary prefix.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to initialize a XMLCalendar
Next Topic:Getting Notification when eContainer has changed
Goto Forum:
  


Current Time: Thu Apr 25 00:44:34 GMT 2024

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

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

Back to the top