You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Ho...@de.ibm.com on 2000/11/09 15:00:53 UTC
Failure opening the schema definition
Hi,
I started working with the Xerces 1.2.1 parser a few days ago. Right now
I'm trying to figure out, if I can use XML schemas instead of DTDs. But
I've trouble reading the schema definitions with the xerces to validate my
xml documents. I always get the following error message:
General Schema Error: Grammar with uri 2: test.xsd , can not found.
This error occurs no matter whether I store the file local or on a HTTP
server. The XML file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<personnel xmlns="http://9.164.160.41/ecm/test"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="http://9.164.160.41/ecm/test
http://9.164.160.41/ecm/test.xsd">
...
</personnel>
The corresponding schema file contains:
<schema xmlns="http://www.w3.org/2000/10/XMLSchema"
targetNamespace="http://9.164.160.41/ecm/test"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2000/10/XMLSchema
http://www.w3.org/2000/10/XMLSchema.xsd"
>
...
</schema>
Any help or idea on this will be very appreciated.
Another question, which is on my mind: if I use derived data types declared
in the schema, is it possible to get the type/name of the superclass while
parsing the document?
Thanks in advance.
Holger
Re: Failure opening the schema definition
Posted by Neil Graham <ne...@jtcsv.com>.
Hi Holger. I tried your example using a local filename in the
schemaLocation attribute of your XML file and had no problems. i.e., I
made your test.xml file read:
<personnel xmlns="http://9.164.160.41/ecm/test"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="http://9.164.160.41/ecm/test
test.xsd">
and received no error messages.
As to your second question: I don't think DOM level 2 has any
provisions to permit one to find what type a given element's type was
derived from. I think schemas will be dealt with in DOM level 3 though,
so no doubt facilities will be available once this spec comes out.
Hope that helps,
Neil
Holger.Juschkewitz@de.ibm.com wrote:
>
> Hi,
>
> I started working with the Xerces 1.2.1 parser a few days ago. Right now
> I'm trying to figure out, if I can use XML schemas instead of DTDs. But
> I've trouble reading the schema definitions with the xerces to validate my
> xml documents. I always get the following error message:
>
> General Schema Error: Grammar with uri 2: test.xsd , can not found.
>
> This error occurs no matter whether I store the file local or on a HTTP
> server. The XML file looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <personnel xmlns="http://9.164.160.41/ecm/test"
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:schemaLocation="http://9.164.160.41/ecm/test
> http://9.164.160.41/ecm/test.xsd">
>
> ...
> </personnel>
>
> The corresponding schema file contains:
>
> <schema xmlns="http://www.w3.org/2000/10/XMLSchema"
> targetNamespace="http://9.164.160.41/ecm/test"
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:schemaLocation="http://www.w3.org/2000/10/XMLSchema
> http://www.w3.org/2000/10/XMLSchema.xsd"
> >
> ...
> </schema>
>
> Any help or idea on this will be very appreciated.
>
> Another question, which is on my mind: if I use derived data types declared
> in the schema, is it possible to get the type/name of the superclass while
> parsing the document?
>
> Thanks in advance.
> Holger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: Failure opening the schema definition
Posted by Elena Litani <hl...@jtcsv.com>.
Hi, Holger,
I am not sure if you have received an answer to your question.
The problem is that "http://www.w3.org/2000/10/XMLSchema-instance"
prefix is not supported yet.
You should change the prefixes as follows:
-- http://www.w3.org/2000/10/XMLSchema-instance =>
http://www.w3.org/1999/XMLSchema-instance
-- http://www.w3.org/2000/10/XMLSchema =>
http://www.w3.org/1999/XMLSchema
Good Luck
Holger.Juschkewitz@de.ibm.com wrote:
>
> Hi,
>
> I started working with the Xerces 1.2.1 parser a few days ago. Right now
> I'm trying to figure out, if I can use XML schemas instead of DTDs. But
> I've trouble reading the schema definitions with the xerces to validate my
> xml documents. I always get the following error message:
>
> General Schema Error: Grammar with uri 2: test.xsd , can not found.
>
> This error occurs no matter whether I store the file local or on a HTTP
> server. The XML file looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <personnel xmlns="http://9.164.160.41/ecm/test"
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:schemaLocation="http://9.164.160.41/ecm/test
> http://9.164.160.41/ecm/test.xsd">
>
> ...
> </personnel>
>
> The corresponding schema file contains:
>
> <schema xmlns="http://www.w3.org/2000/10/XMLSchema"
> targetNamespace="http://9.164.160.41/ecm/test"
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:schemaLocation="http://www.w3.org/2000/10/XMLSchema
> http://www.w3.org/2000/10/XMLSchema.xsd"
> >
> ...
> </schema>
>
> Any help or idea on this will be very appreciated.
>
> Another question, which is on my mind: if I use derived data types declared
> in the schema, is it possible to get the type/name of the superclass while
> parsing the document?
>
> Thanks in advance.
> Holger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: Failure opening the schema definition
Posted by Neil Graham <ne...@jtcsv.com>.
Hi Again Holger... Let me try to do this right this time (it's amazing
how easy it is to get correct results when you don't turn on
validation... :-( )
Holger.Juschkewitz@de.ibm.com wrote:
>
> Hi,
>
> I started working with the Xerces 1.2.1 parser a few days ago. Right now
> I'm trying to figure out, if I can use XML schemas instead of DTDs. But
> I've trouble reading the schema definitions with the xerces to validate my
> xml documents. I always get the following error message:
>
> General Schema Error: Grammar with uri 2: test.xsd , can not found.
>
> This error occurs no matter whether I store the file local or on a HTTP
> server. The XML file looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <personnel xmlns="http://9.164.160.41/ecm/test"
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:schemaLocation="http://9.164.160.41/ecm/test
> http://9.164.160.41/ecm/test.xsd">
First, it woes work if you use a local file. Second, you're using the
wrong namespace for the schema for schemas and the schema structures:
you should be using <http://www.w3.org/1999/XMLSchema-instance> here and
<http://www.w3.org/1999/XMLSchema> in the schema file itself (Xerces
doesn't yet support the schema CR, from which the namespaces you've used
come).
>
> ...
> </personnel>
>
> The corresponding schema file contains:
>
> <schema xmlns="http://www.w3.org/2000/10/XMLSchema"
> targetNamespace="http://9.164.160.41/ecm/test"
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xsi:schemaLocation="http://www.w3.org/2000/10/XMLSchema
> http://www.w3.org/2000/10/XMLSchema.xsd"
> >
> ...
> </schema>
You should also be qualifying the schema element, so that it reads
"xsi:schema", since it is also defined in the XMLSchema namespace.
And those changes will indeed make your sample validate...
Cheers,
Neil
>
> Any help or idea on this will be very appreciated.
>
> Another question, which is on my mind: if I use derived data types declared
> in the schema, is it possible to get the type/name of the superclass while
> parsing the document?
>
> Thanks in advance.
> Holger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org