Home » Archived » XML Schema Definition (XSD) » [newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol://h
[newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol://h [message #50442] |
Wed, 18 August 2004 08:37  |
Eclipse User |
|
|
|
Originally posted by: mehow.remove.neurosoft.net
Hi,
I encounter problem creating a schema model for my schema. I get the
following exception:
org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not
found. (myprotocol://host/path, 2, -1)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
Note that I'm using my own protocol here, but it doesn't seem to be a
problem, since when I was trying to debug it, the parser was invoking
startElement for the schema elements (so the schema has been loaded).
Instead it seems like the schema element cannot be recognized. On the
other the same schema is read successfully from disk using file://
protocol - I don't see the difference.
Here is the schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root"/>
</xs:schema>
Does anybody knows what can cause this problem?
If you need more information to help me, please tell me.
Michal Tkacz
|
|
| |
Re: [newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol [message #50497 is a reply to message #50470] |
Wed, 18 August 2004 10:11   |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
This is a multi-part message in MIME format.
--------------060202090101070702020304
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Michal,
Maybe it would help if you show what you tried.
If you have a URL that you know is a schema but isn't one that EMF will
recognize as one, you can use a technique like this to force an
XSDResourceImpl to be created:
InputStream inputStream =
resourceSet.getURIConverter().createInputStream(uri);
resolvedResource = resourceSet.createResource(URI.createURI("*.xsd"));
resolvedResource.setURI(uri);
resolvedResource.load(inputStream, resourceSet.getLoadOptions());
Michal Tkacz wrote:
> The problem was with the URI: it didn't end with ".xsd". Apparently
> EMF uses the extension of the URI to recognize the type of the document.
>
> It also uses the name of the protocol to find this information, but
> obviously it didn't know anything about my protocol. I guess there
> must be a way to register it somehow - can anyone help me with that?
>
> Michal Tkacz
>
> Michal Tkacz napisał(a):
>
>> Hi,
>>
>> I encounter problem creating a schema model for my schema. I get the
>> following exception:
>>
>> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not
>> found. (myprotocol://host/path, 2, -1)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
>>
>>
>> Note that I'm using my own protocol here, but it doesn't seem to be a
>> problem, since when I was trying to debug it, the parser was invoking
>> startElement for the schema elements (so the schema has been loaded).
>> Instead it seems like the schema element cannot be recognized. On the
>> other the same schema is read successfully from disk using file://
>> protocol - I don't see the difference.
>>
>> Here is the schema:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xs:schema elementFormDefault="qualified"
>> attributeFormDefault="unqualified"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> <xs:element name="root"/>
>> </xs:schema>
>>
>> Does anybody knows what can cause this problem?
>> If you need more information to help me, please tell me.
>>
>> Michal Tkacz
>
--------------060202090101070702020304
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Michal,<br>
<br>
Maybe it would help if you show what you tried. <br>
<br>
If you have a URL that you know is a schema but isn't one that EMF will
recognize as one, you can use a technique like this to force an
XSDResourceImpl to be created:<br>
<blockquote>InputStream inputStream =
resourceSet.getURIConverter().createInputStream(uri);<br>
resolvedResource = resourceSet.createResource(URI.createURI("*.xsd"));<br>
resolvedResource.setURI(uri);<br>
resolvedResource.load(inputStream, resourceSet.getLoadOptions());<br>
</blockquote>
<br>
<br>
Michal Tkacz wrote:<br>
<blockquote cite="midcfvmdd$uc8$1@eclipse.org" type="cite">The problem
was with the URI: it didn't end with ".xsd". Apparently EMF uses the
extension of the URI to recognize the type of the document.
<br>
<br>
It also uses the name of the protocol to find this information, but
obviously it didn't know anything about my protocol. I guess there must
be a way to register it somehow - can anyone help me with that?
<br>
<br>
Michal Tkacz
<br>
<br>
Michal Tkacz napisał(a):
<br>
<br>
<blockquote type="cite">Hi,
<br>
<br>
I encounter problem creating a schema model for my schema. I get the
following exception:
<br>
<br>
org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not
found. (myprotocol://host/path, 2, -1)
<br>
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
<br>
<br>
Note that I'm using my own protocol here, but it doesn't seem to be a
problem, since when I was trying to debug it, the parser was invoking
startElement for the schema elements (so the schema has been loaded).
Instead it seems like the schema element cannot be recognized. On the
other the same schema is read successfully from disk using <a class="moz-txt-link-freetext" href="file://">file://</a>
protocol - I don't see the difference.
<br>
<br>
Here is the schema:
<br>
<br>
<?xml version="1.0" encoding="UTF-8"?>
<br>
<xs:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>>
<br>
<xs:element name="root"/>
<br>
</xs:schema>
<br>
<br>
Does anybody knows what can cause this problem?
<br>
If you need more information to help me, please tell me.
<br>
<br>
Michal Tkacz
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>
--------------060202090101070702020304--
|
|
|
Re: [newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol [message #50525 is a reply to message #50497] |
Wed, 18 August 2004 14:18   |
Eclipse User |
|
|
|
Thanks Ed,
Basically, I wanted to be able to browse schemas that could possibly include or
import one another and that are stored neither in a filesystem nor on a web
server (but in a database).
Since my URIs did not originally end with ".xsd" I was getting the error while
trying to load the main schema (I used ResourceSet.getResource(URI)). Once I
debugged the code I found the reason and appended ".xsd" to the URIs.
Actually, I just realized that once the original schema is loaded, the
imported/included ones would probably be treated as schemas, regardless of
whether their URIs end with ".xsd". If this is the case, I could probably use
your solution to load the main schema. I haven't checked that though.
What I thought is that there could be some mechanism that let you change the
list of mappings protocol -> resource factory (and extension -> resource
factory) that EMF is aware of. Anyway I will have to read some documentation on
EMF since I only read one article on XSD so far.
Again, thanks for help!
Michal
Ed Merks napisał(a):
> Michal,
>
> Maybe it would help if you show what you tried.
>
> If you have a URL that you know is a schema but isn't one that EMF will
> recognize as one, you can use a technique like this to force an
> XSDResourceImpl to be created:
>
> InputStream inputStream =
> resourceSet.getURIConverter().createInputStream(uri);
> resolvedResource = resourceSet.createResource(URI.createURI("*.xsd"));
> resolvedResource.setURI(uri);
> resolvedResource.load(inputStream, resourceSet.getLoadOptions());
>
>
>
> Michal Tkacz wrote:
>
>> The problem was with the URI: it didn't end with ".xsd". Apparently
>> EMF uses the extension of the URI to recognize the type of the document.
>>
>> It also uses the name of the protocol to find this information, but
>> obviously it didn't know anything about my protocol. I guess there
>> must be a way to register it somehow - can anyone help me with that?
>>
>> Michal Tkacz
>>
>> Michal Tkacz napisał(a):
>>
>>> Hi,
>>>
>>> I encounter problem creating a schema model for my schema. I get the
>>> following exception:
>>>
>>> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not
>>> found. (myprotocol://host/path, 2, -1)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
>>>
>>>
>>> Note that I'm using my own protocol here, but it doesn't seem to be a
>>> problem, since when I was trying to debug it, the parser was invoking
>>> startElement for the schema elements (so the schema has been loaded).
>>> Instead it seems like the schema element cannot be recognized. On the
>>> other the same schema is read successfully from disk using file://
>>> protocol - I don't see the difference.
>>>
>>> Here is the schema:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xs:schema elementFormDefault="qualified"
>>> attributeFormDefault="unqualified"
>>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>> <xs:element name="root"/>
>>> </xs:schema>
>>>
>>> Does anybody knows what can cause this problem?
>>> If you need more information to help me, please tell me.
>>>
>>> Michal Tkacz
>>
>
|
|
|
Re: [newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol [message #50554 is a reply to message #50525] |
Wed, 18 August 2004 14:59  |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
Michal,
As you suspected, a resource set has a resource factory registry that
will let you tailor how URIs are mapped to resource factories, so
registering the extension "*" for XSDResourceFactoryImpl should make it
the default for all URIs. The code snippet I showed you is actually
from the code that loads an import or include, so as you deduced, they
don't care about the extension and ensure that the URI is treated as a
schema.
Michal Tkacz wrote:
> Thanks Ed,
>
> Basically, I wanted to be able to browse schemas that could possibly
> include or import one another and that are stored neither in a
> filesystem nor on a web server (but in a database).
> Since my URIs did not originally end with ".xsd" I was getting the
> error while trying to load the main schema (I used
> ResourceSet.getResource(URI)). Once I debugged the code I found the
> reason and appended ".xsd" to the URIs.
> Actually, I just realized that once the original schema is loaded, the
> imported/included ones would probably be treated as schemas,
> regardless of whether their URIs end with ".xsd". If this is the case,
> I could probably use your solution to load the main schema. I haven't
> checked that though.
> What I thought is that there could be some mechanism that let you
> change the list of mappings protocol -> resource factory (and
> extension -> resource factory) that EMF is aware of. Anyway I will
> have to read some documentation on EMF since I only read one article
> on XSD so far.
>
> Again, thanks for help!
>
> Michal
>
>
> Ed Merks napisał(a):
>
>> Michal,
>>
>> Maybe it would help if you show what you tried.
>> If you have a URL that you know is a schema but isn't one that EMF
>> will recognize as one, you can use a technique like this to force an
>> XSDResourceImpl to be created:
>>
>> InputStream inputStream =
>> resourceSet.getURIConverter().createInputStream(uri);
>> resolvedResource =
>> resourceSet.createResource(URI.createURI("*.xsd"));
>> resolvedResource.setURI(uri);
>> resolvedResource.load(inputStream, resourceSet.getLoadOptions());
>>
>>
>>
>> Michal Tkacz wrote:
>>
>>> The problem was with the URI: it didn't end with ".xsd". Apparently
>>> EMF uses the extension of the URI to recognize the type of the
>>> document.
>>>
>>> It also uses the name of the protocol to find this information, but
>>> obviously it didn't know anything about my protocol. I guess there
>>> must be a way to register it somehow - can anyone help me with that?
>>>
>>> Michal Tkacz
>>>
>>> Michal Tkacz napisał(a):
>>>
>>>> Hi,
>>>>
>>>> I encounter problem creating a schema model for my schema. I get
>>>> the following exception:
>>>>
>>>> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema'
>>>> not found. (myprotocol://host/path, 2, -1)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
>>>>
>>>>
>>>> Note that I'm using my own protocol here, but it doesn't seem to be
>>>> a problem, since when I was trying to debug it, the parser was
>>>> invoking startElement for the schema elements (so the schema has
>>>> been loaded). Instead it seems like the schema element cannot be
>>>> recognized. On the other the same schema is read successfully from
>>>> disk using file:// protocol - I don't see the difference.
>>>>
>>>> Here is the schema:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <xs:schema elementFormDefault="qualified"
>>>> attributeFormDefault="unqualified"
>>>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>>> <xs:element name="root"/>
>>>> </xs:schema>
>>>>
>>>> Does anybody knows what can cause this problem?
>>>> If you need more information to help me, please tell me.
>>>>
>>>> Michal Tkacz
>>>
>>>
>>
|
|
|
Re: [newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol [message #590267 is a reply to message #50442] |
Wed, 18 August 2004 09:46  |
Eclipse User |
|
|
|
The problem was with the URI: it didn't end with ".xsd". Apparently EMF
uses the extension of the URI to recognize the type of the document.
It also uses the name of the protocol to find this information, but
obviously it didn't know anything about my protocol. I guess there must
be a way to register it somehow - can anyone help me with that?
Michal Tkacz
Michal Tkacz napisał(a):
> Hi,
>
> I encounter problem creating a schema model for my schema. I get the
> following exception:
>
> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not
> found. (myprotocol://host/path, 2, -1)
> at
> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
>
>
> Note that I'm using my own protocol here, but it doesn't seem to be a
> problem, since when I was trying to debug it, the parser was invoking
> startElement for the schema elements (so the schema has been loaded).
> Instead it seems like the schema element cannot be recognized. On the
> other the same schema is read successfully from disk using file://
> protocol - I don't see the difference.
>
> Here is the schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema elementFormDefault="qualified"
> attributeFormDefault="unqualified"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="root"/>
> </xs:schema>
>
> Does anybody knows what can cause this problem?
> If you need more information to help me, please tell me.
>
> Michal Tkacz
|
|
|
Re: [newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol [message #590288 is a reply to message #50470] |
Wed, 18 August 2004 10:11  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------060202090101070702020304
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Michal,
Maybe it would help if you show what you tried.
If you have a URL that you know is a schema but isn't one that EMF will
recognize as one, you can use a technique like this to force an
XSDResourceImpl to be created:
InputStream inputStream =
resourceSet.getURIConverter().createInputStream(uri);
resolvedResource = resourceSet.createResource(URI.createURI("*.xsd"));
resolvedResource.setURI(uri);
resolvedResource.load(inputStream, resourceSet.getLoadOptions());
Michal Tkacz wrote:
> The problem was with the URI: it didn't end with ".xsd". Apparently
> EMF uses the extension of the URI to recognize the type of the document.
>
> It also uses the name of the protocol to find this information, but
> obviously it didn't know anything about my protocol. I guess there
> must be a way to register it somehow - can anyone help me with that?
>
> Michal Tkacz
>
> Michal Tkacz napisał(a):
>
>> Hi,
>>
>> I encounter problem creating a schema model for my schema. I get the
>> following exception:
>>
>> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not
>> found. (myprotocol://host/path, 2, -1)
>> at
>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
>>
>>
>> Note that I'm using my own protocol here, but it doesn't seem to be a
>> problem, since when I was trying to debug it, the parser was invoking
>> startElement for the schema elements (so the schema has been loaded).
>> Instead it seems like the schema element cannot be recognized. On the
>> other the same schema is read successfully from disk using file://
>> protocol - I don't see the difference.
>>
>> Here is the schema:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xs:schema elementFormDefault="qualified"
>> attributeFormDefault="unqualified"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> <xs:element name="root"/>
>> </xs:schema>
>>
>> Does anybody knows what can cause this problem?
>> If you need more information to help me, please tell me.
>>
>> Michal Tkacz
>
--------------060202090101070702020304
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Michal,<br>
<br>
Maybe it would help if you show what you tried. <br>
<br>
If you have a URL that you know is a schema but isn't one that EMF will
recognize as one, you can use a technique like this to force an
XSDResourceImpl to be created:<br>
<blockquote>InputStream inputStream =
resourceSet.getURIConverter().createInputStream(uri);<br>
resolvedResource = resourceSet.createResource(URI.createURI("*.xsd"));<br>
resolvedResource.setURI(uri);<br>
resolvedResource.load(inputStream, resourceSet.getLoadOptions());<br>
</blockquote>
<br>
<br>
Michal Tkacz wrote:<br>
<blockquote cite="midcfvmdd$uc8$1@eclipse.org" type="cite">The problem
was with the URI: it didn't end with ".xsd". Apparently EMF uses the
extension of the URI to recognize the type of the document.
<br>
<br>
It also uses the name of the protocol to find this information, but
obviously it didn't know anything about my protocol. I guess there must
be a way to register it somehow - can anyone help me with that?
<br>
<br>
Michal Tkacz
<br>
<br>
Michal Tkacz napisał(a):
<br>
<br>
<blockquote type="cite">Hi,
<br>
<br>
I encounter problem creating a schema model for my schema. I get the
following exception:
<br>
<br>
org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not
found. (myprotocol://host/path, 2, -1)
<br>
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
<br>
<br>
Note that I'm using my own protocol here, but it doesn't seem to be a
problem, since when I was trying to debug it, the parser was invoking
startElement for the schema elements (so the schema has been loaded).
Instead it seems like the schema element cannot be recognized. On the
other the same schema is read successfully from disk using <a class="moz-txt-link-freetext" href="file://">file://</a>
protocol - I don't see the difference.
<br>
<br>
Here is the schema:
<br>
<br>
<?xml version="1.0" encoding="UTF-8"?>
<br>
<xs:schema elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>>
<br>
<xs:element name="root"/>
<br>
</xs:schema>
<br>
<br>
Does anybody knows what can cause this problem?
<br>
If you need more information to help me, please tell me.
<br>
<br>
Michal Tkacz
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>
--------------060202090101070702020304--
|
|
|
Re: [newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol [message #590305 is a reply to message #50497] |
Wed, 18 August 2004 14:18  |
Eclipse User |
|
|
|
Thanks Ed,
Basically, I wanted to be able to browse schemas that could possibly include or
import one another and that are stored neither in a filesystem nor on a web
server (but in a database).
Since my URIs did not originally end with ".xsd" I was getting the error while
trying to load the main schema (I used ResourceSet.getResource(URI)). Once I
debugged the code I found the reason and appended ".xsd" to the URIs.
Actually, I just realized that once the original schema is loaded, the
imported/included ones would probably be treated as schemas, regardless of
whether their URIs end with ".xsd". If this is the case, I could probably use
your solution to load the main schema. I haven't checked that though.
What I thought is that there could be some mechanism that let you change the
list of mappings protocol -> resource factory (and extension -> resource
factory) that EMF is aware of. Anyway I will have to read some documentation on
EMF since I only read one article on XSD so far.
Again, thanks for help!
Michal
Ed Merks napisał(a):
> Michal,
>
> Maybe it would help if you show what you tried.
>
> If you have a URL that you know is a schema but isn't one that EMF will
> recognize as one, you can use a technique like this to force an
> XSDResourceImpl to be created:
>
> InputStream inputStream =
> resourceSet.getURIConverter().createInputStream(uri);
> resolvedResource = resourceSet.createResource(URI.createURI("*.xsd"));
> resolvedResource.setURI(uri);
> resolvedResource.load(inputStream, resourceSet.getLoadOptions());
>
>
>
> Michal Tkacz wrote:
>
>> The problem was with the URI: it didn't end with ".xsd". Apparently
>> EMF uses the extension of the URI to recognize the type of the document.
>>
>> It also uses the name of the protocol to find this information, but
>> obviously it didn't know anything about my protocol. I guess there
>> must be a way to register it somehow - can anyone help me with that?
>>
>> Michal Tkacz
>>
>> Michal Tkacz napisał(a):
>>
>>> Hi,
>>>
>>> I encounter problem creating a schema model for my schema. I get the
>>> following exception:
>>>
>>> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not
>>> found. (myprotocol://host/path, 2, -1)
>>> at
>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
>>>
>>>
>>> Note that I'm using my own protocol here, but it doesn't seem to be a
>>> problem, since when I was trying to debug it, the parser was invoking
>>> startElement for the schema elements (so the schema has been loaded).
>>> Instead it seems like the schema element cannot be recognized. On the
>>> other the same schema is read successfully from disk using file://
>>> protocol - I don't see the difference.
>>>
>>> Here is the schema:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <xs:schema elementFormDefault="qualified"
>>> attributeFormDefault="unqualified"
>>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>> <xs:element name="root"/>
>>> </xs:schema>
>>>
>>> Does anybody knows what can cause this problem?
>>> If you need more information to help me, please tell me.
>>>
>>> Michal Tkacz
>>
>
|
|
|
Re: [newbie] org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema' not found. (myprotocol [message #590322 is a reply to message #50525] |
Wed, 18 August 2004 14:59  |
Eclipse User |
|
|
|
Michal,
As you suspected, a resource set has a resource factory registry that
will let you tailor how URIs are mapped to resource factories, so
registering the extension "*" for XSDResourceFactoryImpl should make it
the default for all URIs. The code snippet I showed you is actually
from the code that loads an import or include, so as you deduced, they
don't care about the extension and ensure that the URI is treated as a
schema.
Michal Tkacz wrote:
> Thanks Ed,
>
> Basically, I wanted to be able to browse schemas that could possibly
> include or import one another and that are stored neither in a
> filesystem nor on a web server (but in a database).
> Since my URIs did not originally end with ".xsd" I was getting the
> error while trying to load the main schema (I used
> ResourceSet.getResource(URI)). Once I debugged the code I found the
> reason and appended ".xsd" to the URIs.
> Actually, I just realized that once the original schema is loaded, the
> imported/included ones would probably be treated as schemas,
> regardless of whether their URIs end with ".xsd". If this is the case,
> I could probably use your solution to load the main schema. I haven't
> checked that though.
> What I thought is that there could be some mechanism that let you
> change the list of mappings protocol -> resource factory (and
> extension -> resource factory) that EMF is aware of. Anyway I will
> have to read some documentation on EMF since I only read one article
> on XSD so far.
>
> Again, thanks for help!
>
> Michal
>
>
> Ed Merks napisał(a):
>
>> Michal,
>>
>> Maybe it would help if you show what you tried.
>> If you have a URL that you know is a schema but isn't one that EMF
>> will recognize as one, you can use a technique like this to force an
>> XSDResourceImpl to be created:
>>
>> InputStream inputStream =
>> resourceSet.getURIConverter().createInputStream(uri);
>> resolvedResource =
>> resourceSet.createResource(URI.createURI("*.xsd"));
>> resolvedResource.setURI(uri);
>> resolvedResource.load(inputStream, resourceSet.getLoadOptions());
>>
>>
>>
>> Michal Tkacz wrote:
>>
>>> The problem was with the URI: it didn't end with ".xsd". Apparently
>>> EMF uses the extension of the URI to recognize the type of the
>>> document.
>>>
>>> It also uses the name of the protocol to find this information, but
>>> obviously it didn't know anything about my protocol. I guess there
>>> must be a way to register it somehow - can anyone help me with that?
>>>
>>> Michal Tkacz
>>>
>>> Michal Tkacz napisał(a):
>>>
>>>> Hi,
>>>>
>>>> I encounter problem creating a schema model for my schema. I get
>>>> the following exception:
>>>>
>>>> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'schema'
>>>> not found. (myprotocol://host/path, 2, -1)
>>>> at
>>>> org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:1363)
>>>>
>>>>
>>>> Note that I'm using my own protocol here, but it doesn't seem to be
>>>> a problem, since when I was trying to debug it, the parser was
>>>> invoking startElement for the schema elements (so the schema has
>>>> been loaded). Instead it seems like the schema element cannot be
>>>> recognized. On the other the same schema is read successfully from
>>>> disk using file:// protocol - I don't see the difference.
>>>>
>>>> Here is the schema:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <xs:schema elementFormDefault="qualified"
>>>> attributeFormDefault="unqualified"
>>>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>>> <xs:element name="root"/>
>>>> </xs:schema>
>>>>
>>>> Does anybody knows what can cause this problem?
>>>> If you need more information to help me, please tell me.
>>>>
>>>> Michal Tkacz
>>>
>>>
>>
|
|
|
Goto Forum:
Current Time: Sun May 11 14:01:21 EDT 2025
Powered by FUDForum. Page generated in 0.08284 seconds
|