Issue to load XML file provide with Edapt example project [message #1454435] |
Tue, 28 October 2014 11:40 |
Sylvain Bortelle Messages: 5 Registered: October 2014 |
Junior Member |
|
|
Hello,
I got Edapt project from GIT and I imported project given an example, especially:
- library
- library.edit
- library.editor
- library.example
I'd like to write a basic class that read the XML file (Example.library) given in example. So I created a new project call: library.mytest.
That is a part of my Main file:
LibraryPackage.eINSTANCE.eClass();
ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("library", new XMLResourceFactoryImpl());
Resource resource = resourceSet.getResource(URI.createFileURI(xmlFilePath), true);
Unfortunately, I have this error:
Package with uri 'http : // library/v1' not found.
I don't understand what I do wrong.
After some research may be my mistake can come from plugin.xml file. I don't know what to put in, so it's empty.
Thank you in advance for your help.
[Updated on: Sat, 01 November 2014 18:30] Report message to a moderator
|
|
|
Re: Can't use [message #1454676 is a reply to message #1454435] |
Tue, 28 October 2014 16:50 |
Ed Merks Messages: 33136 Registered: July 2009 |
Senior Member |
|
|
Sylvain,
Comments below.
On 28/10/2014 4:16 PM, Sylvain Bortelle wrote:
> Hello,
>
> I got Edapt project from GIT and I imported project given an example,
> especially:
> - library
> - library.edit
> - library.editor
> - library.example
>
> I'd like to write a basic class that read the XML file
> (Example.library) given in example. So I created a new project call:
> library.mytest.
>
> That is a part of my Main file:
>
> LibraryPackage.eINSTANCE.eClass();
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("library",
> new XMLResourceFactoryImpl());
>
> Resource resource =
> resourceSet.getResource(URI.createFileURI(xmlFilePath), true);
Note that the generated library.xml has an XyzExample.java. It should
work out of the box. Doesn't it?
>
>
> Unfortunately, I have this error:
> Package with uri 'http : // library/v1' not found.
Where did the resource come from? What's the nsURI of your LibraryPackage?
>
> I don't understand what I do wrong.
>
> After some research may be my mistake can come from plugin.xml file. I
> don't know what to put in, so it's empty.
Normally one is generated in the plugin.xml of the model, but if you're
running stand alone, such plugin.xml registrations don't have any impact...
>
> Thank you in advance for your help.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Re: Issue to load XML file provide with Edapt example project [message #1455675 is a reply to message #1455628] |
Wed, 29 October 2014 16:32 |
Sylvain Bortelle Messages: 5 Registered: October 2014 |
Junior Member |
|
|
Thank you for your attention.
Quote:
Yes, in your case is probably LibraryExample.java and it has a main. It
is just an example of how to use your generated model in a stand-alone
context.
Yes you are right. Resource present on GIT are just a basic entry point for introduce Edapt functionality. And I guess a little practice of EMF technology was needed.
Quote:
It's generally a bad idea to load with anything other than an absolute
URI; the problem is that relative references within the loaded resource
won't resolve properly. So you'll see the generated example uses
File.getAbsolutePath for what it passed to URI.createFileURI...
Ok, I will take note of that.
Quote:
So the XML doesn't conform to the model you're trying to use. That just
doesn't work.
Yes, after aligning Model and implementation of Model it's better.
Quote:
Did they provide the example model implementation too?
I have just found the XML for Model version 1. But the goal of this example is to show how load an old XML with a new Model with Edapt process. So I must certainly to create the XML v2 myself.
edit: I found the correct button to edit post.
ps : if a kind moderator can change the title of this topic to clarify it, by: "Issue to load XML file provide with Edapt example project" for example, it would be nice. I haven't found functionality to do this.
[Updated on: Sat, 01 November 2014 18:32] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01754 seconds