Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Problem loading an XML model instance into GUI editor: Package with uri '..' not found
icon5.gif  Problem loading an XML model instance into GUI editor: Package with uri '..' not found [message #1124565] Thu, 03 October 2013 17:13 Go to next message
Lefteris Skoutaris is currently offline Lefteris SkoutarisFriend
Messages: 24
Registered: March 2013
Junior Member
Greetings to all. I am a new eclipse user thus please forgive my ignorance. I will try to be as explanatory and accurate as possible.

1. I have created in eclipse and XML project and loaded an .xsd schema (this produced the .ecore and .genmodel models )
2. I have generated the model code
3. I ran another eclipse instance along with henshin(=editor) plugins in order to model as a graph an XML instance file

When I load to the editor the XML instance file I get the following error:
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd' not found. (platform:/resource/CDM_Transformation/cdm.xml, 5, 37)

It seems that the uri:http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd is the URI existing in the XML instance: <?xml version="1.0" encoding="UTF-8"?>
-<cdm version="1.0" id="CCSDS_CDM_VERS" xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml">

Is it that somehow the editor tries to fetch the above packages and throws an error?

I tried to edit the XML instance file and set the uri locations of the XML packages I have generated as shown in the plugin.xml file:
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="file:/C:/Users/username/workspace/XSDs/ndmxml-1.0-master.xsd"
class="Ndmxml10Master.Ndmxml10MasterPackage"
genModel="model/ndmxml-1.0-master.genmodel"/>
</extension>


but with no lack. I get a class not found error...

The extension below matches the one found in the XML file instance. I guess the editor locates the uri, the class and finally the genModel:
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri="urn:ccsds:recommendation:navigation:schema:ndmxml"
class="ccsds.recommendation.navigation.schema.ndmxml.NdmxmlPackage"
genModel="model/ndmxml-1.0-master.genmodel"/>
</extension>

It seems like a trivial error for someone who is experienced in working with eclipse packages and that is why I ask for your kind help.

I got some ideas of dealing with this problem here: http://www.eclipse.org/forums/index.php/t/274972/ but haven't found a solution yet.
Re: Problem loading an XML model instance into GUI editor: Package with uri '..' not found [message #1125060 is a reply to message #1124565] Fri, 04 October 2013 05:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Lefteris,

Comments below.

On 03/10/2013 7:13 PM, Lefteris Skoutaris wrote:
> Greetings to all. I am a new eclipse user thus please forgive my
> ignorance. I will try to be as explanatory and accurate as possible.
>
> 1. I have created in eclipse and XML project and loaded an .xsd schema
> (this produced the .ecore and .genmodel models )
> 2. I have generated the model code
> 3. I ran another eclipse instance along with henshin(=editor) plugins
> in order to model as a graph an XML instance file
I'm not sure what this specifically means...
>
> When I load to the editor the XML instance file I get the following
> error:
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
> 'http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd' not found.
> (platform:/resource/CDM_Transformation/cdm.xml, 5, 37)
So there is no generated package with that registered namespace
available in the environment where you have this exception.
>
> It seems that the
> uri:http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd is the URI
> existing in the XML instance: <?xml version="1.0" encoding="UTF-8"?>
> -<cdm version="1.0" id="CCSDS_CDM_VERS"
> xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml">
I see, so a null namespace schema is involved somehow? This looks very
odd because your root instance uses
urn:ccsds:recommendation:navigation:schema:ndmxml as the namespace so is
there anything in the instance that uses things from the no namespace
schema? Generally the exception above implies that the context where
this is happening is not using the generated
Ndmxml10MasterResourceFactoryImpl to create your resource for parsing
your model. Is see your extension file is *.xml so that makes it more
challenging to ensure that your resource factory is used because *.xml
files can contain all kinds of things, not just instances of your
model. In general, to deal with issues like that (many different
registered factories for the same file extension), you'd need to define
an Content Type Identifier for your GenPackage and generate the model
for that. If you're using EMF 2.9, the plugin.xml will update,
otherwise you need to delete it and regenerate it.
>
> Is it that somehow the editor tries to fetch the above packages and
> throws an error?
Yes.
>
> I tried to edit the XML instance file
What specifically?
> and set the uri locations of the XML packages I have generated as
> shown in the plugin.xml file:
What was generated before you changed it?
> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri="file:/C:/Users/username/workspace/XSDs/ndmxml-1.0-master.xsd"
> class="Ndmxml10Master.Ndmxml10MasterPackage"
Did you not set the GenPackage's Base Package property or use the
ecore:package annotation in your no target namespace schema? This
unconventional Java naming result is likely to cause you problems.
> genModel="model/ndmxml-1.0-master.genmodel"/>
> </extension>
> but with no lack. I get a class not found error...
What specifically to you mean by this? You're saying there is no such
class as Ndmxml10Master.Ndmxml10MasterPackage? Or it's an exception
will parsing the instance?
>
> The extension below matches the one found in the XML file instance.
The actual root element's namespace, yes...
> I guess the editor locates the uri, the class and finally the genModel:
No, it locates the EPackage.
> <extension point="org.eclipse.emf.ecore.generated_package">
> <package
> uri="urn:ccsds:recommendation:navigation:schema:ndmxml"
> class="ccsds.recommendation.navigation.schema.ndmxml.NdmxmlPackage"
> genModel="model/ndmxml-1.0-master.genmodel"/>
> </extension>
>
> It seems like a trivial error for someone who is experienced in
> working with eclipse packages and that is why I ask for your kind help.
>
> I got some ideas of dealing with this problem here:
> http://www.eclipse.org/forums/index.php/t/274972/ but haven't found a
> solution yet.

First thing I'd try is to see if
xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd"
in the instance is needed for anything. I.e.., does it parse without
that? If not, you'll really need to deal with content types if you
really insist on using a non-unique file extension like *.xml for your
instances. Easier if you use something unique for your model.

I also find it very odd that your instance uses
xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml" as the
namespace but when I loook at
http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd, I see it's a no
target namespace schema and defines

<xsd:element name="cdm" type="ndm:cdmType"/>

But given that your root element has a namespace, it doesn't correspond
to this element declaration. So I also get the strong sense that your
instance doesn't conform to your schemas (regardless of all this EMF
stuff your doing) so no matter what you do, it's not going to work.
Start by confirming the validity of your instance. One way to do that is
look at the Ecore model you have with the namespace
"urn:ccsds:recommendation:navigation:schema:ndmxml" as it's nsURI, find
the DocumentRoot EClass, and see if it has a feature called "cdm". If
not, that namespace doesn't define a global element named "cdm".


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Problem loading an XML model instance into GUI editor: Package with uri '..' not found [message #1125556 is a reply to message #1125060] Fri, 04 October 2013 16:44 Go to previous messageGo to next message
Lefteris Skoutaris is currently offline Lefteris SkoutarisFriend
Messages: 24
Registered: March 2013
Junior Member
>Lefteris,
>
>Comments below.

Hello Ed and thank you for your kind reply.

>
>On 03/10/2013 7:13 PM, Lefteris Skoutaris wrote:
>> Greetings to all. I am a new eclipse user thus please forgive my
>> ignorance. I will try to be as explanatory and accurate as possible.
>>
>> 1. I have created in eclipse and XML project and loaded an .xsd schema
>> (this produced the .ecore and .genmodel models )
>> 2. I have generated the model code
>> 3. I ran another eclipse instance along with henshin(=editor) plugins
>> in order to model as a graph an XML instance file
>I'm not sure what this specifically means...

The general idea is using EMF to model the structure of XML files using a specific schema and finally a visual editor to specify such structures as a graph and apply modifications dynamically.

>>
>> When I load to the editor the XML instance file I get the following
>> error:
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
>> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
>> 'http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd' not found.
>> (platform:/resource/CDM_Transformation/cdm.xml, 5, 37)
>So there is no generated package with that registered namespace
>available in the environment where you have this exception.

Yes. When I load the XML instance file into the editor I get the above error since I suppose the editor parses the XML file and looks for the package http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd that does not exist. The packages as shown in the plugin.xml are two with uri's (as listed at my first post):
uri="urn:ccsds:recommendation:navigation:schema:ndmxml
uri="file:/C:/Users/username/workspace/XSDs/ndmxml-1.0-master.xsd"

>>
>> It seems that the
>> uri:http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd is the URI
>> existing in the XML instance: <?xml version="1.0" encoding="UTF-8"?>
>> -<cdm version="1.0" id="CCSDS_CDM_VERS"
>> xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml">
>
>I see, so a null namespace schema is involved somehow? This looks very
>odd because your root instance uses
>urn:ccsds:recommendation:navigation:schema:ndmxml as the namespace so is
>there anything in the instance that uses things from the no namespace
>schema?

Well, it seems that the "http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd" imports the urn:ccsds:recommendation:navigation:schema:ndmxml called ndmxml-1.0-namespace-1.1.xsd and defines several elements from which I am interested in the <xsd:element name="cdm" type="ndm:cdmType"/>.


> Generally the exception above implies that the context where
>this is happening is not using the generated
>Ndmxml10MasterResourceFactoryImpl to create your resource for parsing
>your model. Is see your extension file is *.xml so that makes it more
>challenging to ensure that your resource factory is used because *.xml
>files can contain all kinds of things, not just instances of your
>model. In general, to deal with issues like that (many different
>registered factories for the same file extension), you'd need to define
>an Content Type Identifier for your GenPackage and generate the model
>for that. If you're using EMF 2.9, the plugin.xml will update,
>otherwise you need to delete it and regenerate it.

I'm not sure what you mean here. I am not familiar with Content type identifiers. I will further look into it.

>>
>> Is it that somehow the editor tries to fetch the above packages and
>> throws an error?
>Yes.
>>
>> I tried to edit the XML instance file
>What specifically?

I changed the field (http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd) in: <?xml version="1.0" encoding="UTF-8"?>
-<cdm version="1.0" id="CCSDS_CDM_VERS"
xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml">

with the uri namespace of the model package I have generated in eclipse, which is:"file:/C:/Users/username/workspace/XSDs/ndmxml-1.0-master.xsd"
class="Ndmxml10Master.Ndmxml10MasterPackage", as shown in the plugin.xml file and I got a new error: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'cdm' is not found or is abstract. (platform:/resource/CDM_Transformation/xml_instance_test.xml, 2, 264), which I cannot interpret. Is it that the "cdm" element field is not generated in the model as a java class?

>> and set the uri locations of the XML packages I have generated as
>> shown in the plugin.xml file:
>What was generated before you changed it?

Before I change it I used to get the error of not finding the corresponding model package: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd' not found. (platform:/resource/CDM_Transformation/29108_conj_34999_JAN_2013006_1.cdm.xml, 5, 37)

>> <extension point="org.eclipse.emf.ecore.generated_package">
>> <package
>> uri="file:/C:/Users/username/workspace/XSDs/ndmxml-1.0-master.xsd"
>> class="Ndmxml10Master.Ndmxml10MasterPackage"
>Did you not set the GenPackage's Base Package property or use the
>ecore:package annotation in your no target namespace schema? This
>unconventional Java naming result is likely to cause you problems.

Most likely it is a naming problem. Are you referring to mapping the packages namings with the namespaces in the instance file? I do not understand fully your concept.

>> genModel="model/ndmxml-1.0-master.genmodel"/>
>> </extension>
>> but with no lack. I get a class not found error...
>What specifically to you mean by this? You're saying there is no such
>class as Ndmxml10Master.Ndmxml10MasterPackage? Or it's an exception
>will parsing the instance?

I changed the field in the XML instance file from http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd to file:/C:/Users/username/workspace-indigo/XSDs/ndmxml-1.0-master.xsd and got this error now: Class 'cdm' is not found or is abstract.

It seems from the plugin.xml that the uri:"file:/C:/Users/username/workspace-indigo/XSDs/ndmxml-1.0-master.xsd" and the editor looked for class 'cdm' instead of ndmxml10Master.Ndmxml10MasterPackage.


>>
>> The extension below matches the one found in the XML file instance.
>The actual root element's namespace, yes...
>> I guess the editor locates the uri, the class and finally the genModel:
>
>No, it locates the EPackage.
>
>> <extension point="org.eclipse.emf.ecore.generated_package">
>> <package
>> uri="urn:ccsds:recommendation:navigation:schema:ndmxml"
>> class="ccsds.recommendation.navigation.schema.ndmxml.NdmxmlPackage"
>> genModel="model/ndmxml-1.0-master.genmodel"/>
>> </extension>
>>
>> It seems like a trivial error for someone who is experienced in
>> working with eclipse packages and that is why I ask for your kind help.
>>
>> I got some ideas of dealing with this problem here:
>> http://www.eclipse.org/forums/index.php/t/274972/ but haven't found a
>> solution yet.
>
>First thing I'd try is to see if
>xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml->1.0-master.xsd"
>in the instance is needed for anything. I.e.., does it parse without
>that?

I have removed it and still doesn't parse: Class 'cdm' is not found or is abstract.(Does this mean that a cdm.java is required in the generated model package? Does it fail to interpret the 'cdm' element in the file instance? )

>If not, you'll really need to deal with content types if you
>really insist on using a non-unique file extension like *.xml for your
>instances. Easier if you use something unique for your model.

Ok.

>I also find it very odd that your instance uses
>xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml" as the
>namespace but when I look at
>http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd, I see it's a no
>target namespace schema and defines
>
><xsd:element name="cdm" type="ndm:cdmType"/>
>But given that your root element has a namespace, it doesn't correspond
>to this element declaration.

You mean that the root element should have a tag <cdm>...</cdm> and nothing else in it? I think I have lost you here. :/

>So I also get the strong sense that your
>instance doesn't conform to your schemas (regardless of all this EMF
>stuff your doing) so no matter what you do, it's not going to work.
>Start by confirming the validity of your instance. One way to do that is
>look at the Ecore model you have with the namespace
>"urn:ccsds:recommendation:navigation:schema:ndmxml" as it's nsURI, find
>the DocumentRoot EClass, and see if it has a feature called "cdm". If
>not, that namespace doesn't define a global element named "cdm".

There is no DocumentRoot under the urn:ccsds:recommendation:navigation:schema:ndmxml model. It is under the file:/C:/Users/username/workspace-indigo/XSDs/ndmxml-1.0-master.xsd model and Ndmxml10Master package.

There are two functions there related to cdm in the DocumentRoot:
void setCdm(CdmType value);
CdmType getCdm();

I think you have a point here and that is why I get this "cdm" class error when I change the schema location to that in the plugin.xml.
Does this mean that the editor cannot interpret the "cdm" tag in the file instance based on the currently generated model namings? i.e. a class "cdm" should have been generated and exist in the model packages?

Why such a class is not generated since an element of "cdm" is defined in the ndmxml-1.0-master.xsd schema? I have loaded this schema when creating the XML project.

I am attaching the instance file as well. The schemas seem to comply.
Re: Problem loading an XML model instance into GUI editor: Package with uri '..' not found [message #1125583 is a reply to message #1125556] Fri, 04 October 2013 17:18 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Lefteris,

I spent a significant amount of time giving a detailed answer, but I
won't have the patience to go through a long round of such things and I
won't have the time to explain all kinds of XML Schema concepts and XML
concepts. But I'll take one more pass at this and if you bounce back
essentially the same questions, I'll give up.

On 04/10/2013 6:44 PM, Lefteris Skoutaris wrote:
>> Lefteris,
>>
>> Comments below.
> Hello Ed and thank you for your kind reply.
>
>> On 03/10/2013 7:13 PM, Lefteris Skoutaris wrote:
>>> Greetings to all. I am a new eclipse user thus please forgive my
>>> ignorance. I will try to be as explanatory and accurate as possible.
>>>
>>> 1. I have created in eclipse and XML project and loaded an .xsd schema
>>> (this produced the .ecore and .genmodel models )
>>> 2. I have generated the model code
>>> 3. I ran another eclipse instance along with henshin(=editor) plugins
>>> in order to model as a graph an XML instance file
>> I'm not sure what this specifically means...
> The general idea is using EMF to model the structure of XML files using a specific schema and finally a visual editor to specify such structures as a graph and apply modifications dynamically.
So that's not really relevant to the question?
>
>>> When I load to the editor the XML instance file I get the following
>>> error:
>>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException:
>>> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
>>> 'http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd' not found.
>>> (platform:/resource/CDM_Transformation/cdm.xml, 5, 37)
>> So there is no generated package with that registered namespace
>> available in the environment where you have this exception.
> Yes. When I load the XML instance file into the editor
I assume you mean in your generated editor.
> I get the above error since I suppose the editor parses the XML file and looks for the package http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd that does not exist.
Yes, though if you look closely at the generated model for your no
namespace schema, you'll see it there's a generated resource factory
impl that registers your package for the null namespace. You'll need
such a registration...
> The packages as shown in the plugin.xml are two with uri's (as listed at my first post):
> uri="urn:ccsds:recommendation:navigation:schema:ndmxml
> uri="file:/C:/Users/username/workspace/XSDs/ndmxml-1.0-master.xsd"
You should not change these things in plugin.xmls that are generated.
Change them back, or delete the plugin.xml and regenerate it. You'll
only mess things up.
>
>>> It seems that the
>>> uri:http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd is the URI
>>> existing in the XML instance: <?xml version="1.0" encoding="UTF-8"?>
>>> -<cdm version="1.0" id="CCSDS_CDM_VERS"
>>> xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml">
>> I see, so a null namespace schema is involved somehow? This looks very
>> odd because your root instance uses
>> urn:ccsds:recommendation:navigation:schema:ndmxml as the namespace so is
>> there anything in the instance that uses things from the no namespace
>> schema?
> Well, it seems that the "http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd" imports the urn:ccsds:recommendation:navigation:schema:ndmxml called ndmxml-1.0-namespace-1.1.xsd and defines several elements from which I am interested in the <xsd:element name="cdm" type="ndm:cdmType"/>.
Yes, exactly, and that schema has no target namespace so element
conforming to that schema should have no namespace.
>
>
>> Generally the exception above implies that the context where
>> this is happening is not using the generated
>> Ndmxml10MasterResourceFactoryImpl to create your resource for parsing
>> your model. Is see your extension file is *.xml so that makes it more
>> challenging to ensure that your resource factory is used because *.xml
>> files can contain all kinds of things, not just instances of your
>> model. In general, to deal with issues like that (many different
>> registered factories for the same file extension), you'd need to define
>> an Content Type Identifier for your GenPackage and generate the model
>> for that. If you're using EMF 2.9, the plugin.xml will update,
>> otherwise you need to delete it and regenerate it.
> I'm not sure what you mean here. I am not familiar with Content type identifiers. I will further look into it.
Yes, you'll have to learn about that if you really must use *.xml for
your extension.
>
>>> Is it that somehow the editor tries to fetch the above packages and
>>> throws an error?
>> Yes.
>>> I tried to edit the XML instance file
>> What specifically?
> I changed the field (http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd) in: <?xml version="1.0" encoding="UTF-8"?>
> -<cdm version="1.0" id="CCSDS_CDM_VERS"
> xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml">
>
> with the uri namespace of the model package I have generated in eclipse, which is:"file:/C:/Users/username/workspace/XSDs/ndmxml-1.0-master.xsd"
That won't help.
> class="Ndmxml10Master.Ndmxml10MasterPackage", as shown in the plugin.xml file
Is that really the name of a generated package? The generator produces
the real correct name (even if it's a poor name) so changing is not
likely to help.
> and I got a new error: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'cdm' is not found or is abstract. (platform:/resource/CDM_Transformation/xml_instance_test.xml, 2, 264), which I cannot interpret. Is it that the "cdm" element field is not generated in the model as a java class?
It's hard to say when so many things appears to be messed with.
>
>>> and set the uri locations of the XML packages I have generated as
>>> shown in the plugin.xml file:
>> What was generated before you changed it?
> Before I change it I used to get the error of not finding the corresponding model package: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd' not found. (platform:/resource/CDM_Transformation/29108_conj_34999_JAN_2013006_1.cdm.xml, 5, 37)
Yes, because you're not using the generated resource factory for the
http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd model.
>
>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>> <package
>>> uri="file:/C:/Users/username/workspace/XSDs/ndmxml-1.0-master.xsd"
>>> class="Ndmxml10Master.Ndmxml10MasterPackage"
>> Did you not set the GenPackage's Base Package property or use the
>> ecore:package annotation in your no target namespace schema? This
>> unconventional Java naming result is likely to cause you problems.
> Most likely it is a naming problem. Are you referring to mapping the packages namings with the namespaces in the instance file? I do not understand fully your concept.

I'm referring to "Ndmxml10Master.Ndmxml10MasterPackage". Have you ever
seen a Java package name that starts with an upper case letter? Have
you noticed that Java packages typically start with things like
org.eclipse, and com.ibm?
>
>>> genModel="model/ndmxml-1.0-master.genmodel"/>
>>> </extension>
>>> but with no lack. I get a class not found error...
>> What specifically to you mean by this? You're saying there is no such
>> class as Ndmxml10Master.Ndmxml10MasterPackage? Or it's an exception
>> will parsing the instance?
> I changed the field in the XML instance file from http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd to file:/C:/Users/username/workspace-indigo/XSDs/ndmxml-1.0-master.xsd and got this error now: Class 'cdm' is not found or is abstract.
Yes, that's not going to help, because you're not using the generated
resource factory.
>
> It seems from the plugin.xml that the uri:"file:/C:/Users/username/workspace-indigo/XSDs/ndmxml-1.0-master.xsd" and the editor looked for class 'cdm' instead of ndmxml10Master.Ndmxml10MasterPackage.
No, you're confusing the parser trying to resolve a "cdm" to something
in your model to the plugin.xml extension processor needing to find
classes by name on the classpath.
>
>
>>> The extension below matches the one found in the XML file instance.
>> The actual root element's namespace, yes...
>>> I guess the editor locates the uri, the class and finally the genModel:
>> No, it locates the EPackage.
>>
>>> <extension point="org.eclipse.emf.ecore.generated_package">
>>> <package
>>> uri="urn:ccsds:recommendation:navigation:schema:ndmxml"
>>> class="ccsds.recommendation.navigation.schema.ndmxml.NdmxmlPackage"
>>> genModel="model/ndmxml-1.0-master.genmodel"/>
>>> </extension>
>>>
>>> It seems like a trivial error for someone who is experienced in
>>> working with eclipse packages and that is why I ask for your kind help.
>>>
>>> I got some ideas of dealing with this problem here:
>>> http://www.eclipse.org/forums/index.php/t/274972/ but haven't found a
>>> solution yet.
>> First thing I'd try is to see if
>> xsi:noNamespaceSchemaLocation="http://sanaregistry.org/r/ndmxml/ndmxml->1.0-master.xsd"
>> in the instance is needed for anything. I.e.., does it parse without
>> that?
> I have removed it and still doesn't parse: Class 'cdm' is not found or is abstract.
Because you're not using the generated resource factory.
> (Does this mean that a cdm.java is required in the generated model package?
No, it means it can't find anything to correspond to "cdm" in your Ecore
model.
> Does it fail to interpret the 'cdm' element in the file instance? )
You're questions are making my brain hurt. I don't have the patience
for an XML Schema 101 lesson.
>
>> If not, you'll really need to deal with content types if you
>> really insist on using a non-unique file extension like *.xml for your
>> instances. Easier if you use something unique for your model.
> Ok.
>
>> I also find it very odd that your instance uses
>> xmlns="urn:ccsds:recommendation:navigation:schema:ndmxml" as the
>> namespace but when I look at
>> http://sanaregistry.org/r/ndmxml/ndmxml-1.0-master.xsd, I see it's a no
>> target namespace schema and defines
>>
>> <xsd:element name="cdm" type="ndm:cdmType"/>
>> But given that your root element has a namespace, it doesn't correspond
>> to this element declaration.
> You mean that the root element should have a tag <cdm>...</cdm> and nothing else in it? I think I have lost you here. :/
See the xmlns="..." declaration. That defines a default XML namespace
prefix. So, because your root element has no prefix, it uses the
default namespace prefix's namespace. There should be no xmlns="..."
declaration because you need a null namespace on the root element.
Please read about XML namespace qualification if you're still confused.
>
>> So I also get the strong sense that your
>> instance doesn't conform to your schemas (regardless of all this EMF
>> stuff your doing) so no matter what you do, it's not going to work.
>> Start by confirming the validity of your instance. One way to do that is
>> look at the Ecore model you have with the namespace
>> "urn:ccsds:recommendation:navigation:schema:ndmxml" as it's nsURI, find
>> the DocumentRoot EClass, and see if it has a feature called "cdm". If
>> not, that namespace doesn't define a global element named "cdm".
> There is no DocumentRoot under the urn:ccsds:recommendation:navigation:schema:ndmxml model.
Yes, I'm not surprised because that namespace doesn't define elements,
only complex types.
> It is under the file:/C:/Users/username/workspace-indigo/XSDs/ndmxml-1.0-master.xsd model and Ndmxml10Master package.
Yes, and that schema has no namespace, and so the element in the
instance mustn't have an implicit namespace.
>
> There are two functions there related to cdm in the DocumentRoot:
> void setCdm(CdmType value);
> CdmType getCdm();
>
> I think you have a point here and that is why I get this "cdm" class error when I change the schema location to that in the plugin.xml.
It's also important to use the right load options when loading, i.e.,
the ones you'll see in your generated resource factory in the
model/project where you have this document root class.
> Does this mean that the editor cannot interpret the "cdm" tag in the file instance based on the currently generated model namings?
Yes.
> i.e. a class "cdm" should have been generated and exist in the model packages?
No. As I said above, it should be looking for a document root, and your
model has one and it has a feature corresponding to "cdm", so that
should all work, if you leave the plugin.xmls alone, you ensure that
you're actually using the generated resource factory, and you ensure you
start with a valid instance that properly conforms to the schema, which
you don't current have. So try to use the generated wizard to create an
instance from scratch to see what a correct instance looks like.
>
> Why such a class is not generated since an element of "cdm" is defined in the ndmxml-1.0-master.xsd schema?
Because there's no complex type called cdm.
> I have loaded this schema when creating the XML project.
Yes, you explained that.
>
> I am attaching the instance file as well. The schemas seem to comply.
What makes it seem that way to you? It seems to me it doesn't comply so
unless you can find an element declaration in a schema with
targetNamespace="urn:ccsds:recommendation:navigation:schema:ndmxml",
don't expect the parser to find one either.
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to define my own "ecore" metamodel
Next Topic:(non) modifiable attributes...
Goto Forum:
  


Current Time: Thu Apr 18 16:03:10 GMT 2024

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

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

Back to the top