Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Cannot find eProxyURI: platform:/plugin/org.eclipse.xsd/model/XSD.ecore#//XSDSchema
Cannot find eProxyURI: platform:/plugin/org.eclipse.xsd/model/XSD.ecore#//XSDSchema [message #868550] Wed, 02 May 2012 07:51 Go to next message
Tex Iano is currently offline Tex IanoFriend
Messages: 99
Registered: February 2012
Member
Hi,

I am trying to use ATL in order to transform an XML document.

When I try to load the corresponding XML schema

metaModel = mh.createModelLoader().loadModel("MyXSD", mh.createModelLoader().getMOF(), metaModelUrl.openStream());


I get:

Resource for org.eclipse.emf.ecore.impl.EClassImpl@9830bc (eProxyURI: platform:/plugin/org.eclipse.xsd/model/XSD.ecore#//XSDSchema) is null; cannot be referenced


I am using ATL programmatically, I want to embed it into an plain Java application, so I cannot use the Plugins.

So, obviously when loading the XSD, EMF wants to access the XSD meta model and cannot find it. I have found the XSD.ecore. But my problem now is: How can I tell EMF to map platform:/plugin/org.eclipse.xsd/model/XSD.ecore#//XSDSchema to my local ecore file?

Regards,

Tex
Re: Cannot find eProxyURI: platform:/plugin/org.eclipse.xsd/model/XSD.ecore#//XSDSchema [message #868558 is a reply to message #868550] Wed, 02 May 2012 08:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Comments below.

On 02/05/2012 9:51 AM, Tex Iano wrote:
> Hi,
>
> I am trying to use ATL in order to transform an XML document.
>
> When I try to load the corresponding XML schema
>
> metaModel = mh.createModelLoader().loadModel("MyXSD",
> mh.createModelLoader().getMOF(), metaModelUrl.openStream());
>
>
> I get:
> Resource for mailto:org.eclipse.emf.ecore.impl.EClassImpl@9830bc
> (eProxyURI:
> platform:/plugin/org.eclipse.xsd/model/XSD.ecore#//XSDSchema) is null;
> cannot be referenced
>
>
> I am using ATL programmatically, I want to embed it into an plain Java
> application, so I cannot use the Plugins.
> So, obviously when loading the XSD, EMF wants to access the XSD meta
> model and cannot find it. I have found the XSD.ecore. But my problem
> now is: How can I tell EMF to map
> platform:/plugin/org.eclipse.xsd/model/XSD.ecore#//XSDSchema to my
> local ecore file?
You can use
URI.createURI(XSDPlugin.INSTANCE.getBaseURL().toExternalForm()) to get
the location of the jar in which the model is contained and use that to
create a mapping from platform:/plugin/org.eclipse.xsd/ to that jar.
E.g., the following will load the model in a stand alone context:

public static void main(String[] args) throws Exception
{
ResourceSetImpl resourceSet = new ResourceSetImpl();

resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore",
new EcoreResourceFactoryImpl());

resourceSet.getURIConverter().getURIMap().put(URI.createPlatformPluginURI("/org.eclipse.xsd/",
true), URI.createURI(XSDPlugin.INSTANCE.getBaseURL().toExternalForm()));
Resource xsdEcoreResource =
resourceSet.getResource(URI.createPlatformPluginURI("/org.eclipse.xsd/model/XSD.ecore",
true), true);
xsdEcoreResource.save(System.out, null);
}

Note that the above uses a folder mapping so that everything referenced
below the bundle URI is redirected to the jar URI.
>
> Regards,
>
> Tex


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:What is the recommended way of joining multiple XSDs in a single ECore model?
Next Topic:Databinding of a matrix model with a TableViewer
Goto Forum:
  


Current Time: Fri Apr 26 05:06:40 GMT 2024

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

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

Back to the top