|
Re: noNamespaceSchemaLocation URI resolution with catalog entry [message #1069629 is a reply to message #1069612] |
Tue, 16 July 2013 09:13 |
Ed Merks Messages: 33136 Registered: July 2009 |
Senior Member |
|
|
Vincent,
Comments below.
On 16/07/2013 10:34 AM, Vincent De Bry wrote:
> Hi,
>
> I have created an EMF model from a XSD, and generated the
> corresponding editor.
> I have added "xml" to the extensions of this editor so that I can open
> a xml file with it.
It sounds like you need to make use of content types in this case.
>
> My xml file defines a "xsi:noNamespaceSchemaLocation" attribute with
> an abstract URI for which an entry "System" has been defined in the
> xml catalog in order to resolve the abstration.
XML catalog isn't something provided by EMF nor something EMF is aware
of. EMF has similar mechanisms, i.e., URI mappings in the URI
converter. Such mappings can even be defined in the plugin.xml...
Are you using
http://wiki.eclipse.org/index.php/EMF/FAQ#How_can_I_ensure_that_an_xsi:schemaLocation_is_serialized_for_my_packages.3F
>
> When opening my xml file with the editor, it appears that the xml
> catalog entry has not been used for the abstract URI resolution and
> the editor can not open my file.
>
> What should I do ? Do I have to override a method of the generated
> editor ? If so which one and how ? Else, what should I do ?
It sounds like you should make use of content types. You can configure
that in the GenPackage's properties. If you use something older than
EMF 2.9, you need to delete the plugin.xml files (including the editor's
one) to regenerate them.
>
> Thank you.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: noNamespaceSchemaLocation URI resolution with catalog entry [message #1069643 is a reply to message #1069629] |
Tue, 16 July 2013 09:52 |
Vincent De Bry Messages: 55 Registered: May 2013 |
Member |
|
|
Hi Ed,
Thank you for your help.
the eNS_URI used in my "initializePackageContents" is the path to my real schema ("platform:/resource/com.debry.xmleditor/schema/ComponentType.xsd")
trying to override the createResource method with the abstract URI ("debry:ComponentType.xsd") does not make it work.
I have also tried to modify the "plugin.properties" of the generated editor with
"_UI_ComponentTypeEditorFilenameExtensions = componenttype,xml", by adding ",xml" as I understood your proposal, but I still got the following exception while opening my xml file with the editor:
org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'debry:ComponentType.xsd' not found. (platform:/resource/MyProject/myComponent/component.xml, 3, 128)
Probably I did not catch correctly your thought.
[Updated on: Tue, 16 July 2013 09:55] Report message to a moderator
|
|
|
Re: noNamespaceSchemaLocation URI resolution with catalog entry [message #1069790 is a reply to message #1069643] |
Tue, 16 July 2013 15:08 |
Ed Merks Messages: 33136 Registered: July 2009 |
Senior Member |
|
|
Vincent,
Comments below.
On 16/07/2013 11:52 AM, Vincent De Bry wrote:
> Hi Ed,
>
> Thank you for your help.
>
> the eNS_URI used in my "initializePackageContents" is the path to my
> real schema
> ("platform:/resource/com.debry.xmleditor/schema/ComponentType.xsd")
This kind of assumes the model is always in the workspace as a project.
That doesn't seem like a good assumption.
>
> trying to override the createResource method with the abstract URI
> ("debry:ComponentType.xsd") does not make it work.
What's the purpose of that?
>
> I have also tried to modify the "plugin.properties" of the generated
> editor with
> "_UI_ComponentTypeEditorFilenameExtensions = componenttype,xml", by
> adding ",xml" as I understood your proposal, but I still got the
> following exception while opening my xml file with the editor:
>
> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
> 'softima:ComponentType.xsd' not found.
> (platform:/resource/SoftArcadiaProject/01-Components/myComponent/component.xml,
> 3, 128)
>
> Probably I did not catch correctly your thought.
Did you find the GenPackage? It has a Content Type Identifier property
you can set so something like org.example.your.package and the
regenerated. The plugin.xml for the model and editor should reflect
this change. If you're using older releases of EMF that don't support
plugin.xml merging, you can delete those and regenerate them.
Are you actually using the generated resource factory to create your
resource? That should just work out of the box without all the stuff
you mention you're doing.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02927 seconds