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 Sean Hennessy <sh...@edupoint.com> on 2000/10/26 01:41:09 UTC
grammar not found
given example.xml
with
<?xml version="1.0"?>
<PriceRequest Version="1.0"
xmlns="http://www.publishing.org/namespaces/PriceRequest"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:SchemaLocation="http://www.publishing.org/namespaces/PriceRequest
PriceRequest.xsd">
...
and PriceRequest.xsd
<?xml version="1.0"?>
<schema
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
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"
targetNamespace="http://www.publishing.org/namespaces/PriceRequest"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:msn="http://www.publishing.org/namespaces/PriceRequest">
..
using example.java
mDOMParser = (org.apache.xerces.parsers.DOMParser)Class.forName(
maStrParserName[0] ).newInstance();
((DOMParser)mDOMParser).setFeature(
"http://apache.org/xml/features/dom/defer-node-expansion",
setDeferredDOM );
((DOMParser)mDOMParser).setFeature(
"http://xml.org/sax/features/validation",
setValidation );
((DOMParser)mDOMParser).setFeature(
"http://xml.org/sax/features/namespaces",
setNameSpaces );
((DOMParser)mDOMParser).setFeature(
"http://apache.org/xml/features/validation/schema",
setSchemaSupport );
mDOMParser.parse( tInputSource ); //example.xml
generates the following output..
"http://www.publishing.org/namespaces/PriceRequest grammar not found"
Would someone please tell me if the parser is complaining about the
defaultNamespace in the XML instance, the targetNameSpace in the xsd or that
it cannot find the actual .xsd file?
Thanks,
W. Sean Hennessy
Re: grammar not found
Posted by Eric Ye <er...@locus.apache.org>.
grammar not foundThe problem is the namepsace URI for prefix "xsi" : "http://www.w3.org/2000/10/XMLSchema-instance", is not supported yet, same thing for prefix "xsd", Please change them to :
http://www.w3.org/1999/XMLSchema-instance
and
http://www.w3.org/1999/XMLSchema
BE AWARE only 04/07 version of schema spec is supported by Xerces-J 1.2.x at this point, and the syntax for complex type and simple type has changed in the 09/22 version or the CR version, new syntax is currently NOT supported by Xerces-J , it's on the list of things to do though.
_____
Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org
----- Original Message -----
From: Sean Hennessy
To: xerces-j-dev@xml.apache.org
Sent: Wednesday, October 25, 2000 4:41 PM
Subject: grammar not found
given example.xml
with
<?xml version="1.0"?>
<PriceRequest Version="1.0" xmlns="http://www.publishing.org/namespaces/PriceRequest" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xsi:SchemaLocation="http://www.publishing.org/namespaces/PriceRequest PriceRequest.xsd">
...
and PriceRequest.xsd
<?xml version="1.0"?>
<schema
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
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"
targetNamespace="http://www.publishing.org/namespaces/PriceRequest"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:msn="http://www.publishing.org/namespaces/PriceRequest">
..
using example.java
mDOMParser = (org.apache.xerces.parsers.DOMParser)Class.forName( maStrParserName[0] ).newInstance();
((DOMParser)mDOMParser).setFeature( "http://apache.org/xml/features/dom/defer-node-expansion",
setDeferredDOM );
((DOMParser)mDOMParser).setFeature( "http://xml.org/sax/features/validation",
setValidation );
((DOMParser)mDOMParser).setFeature( "http://xml.org/sax/features/namespaces",
setNameSpaces );
((DOMParser)mDOMParser).setFeature( "http://apache.org/xml/features/validation/schema",
setSchemaSupport );
mDOMParser.parse( tInputSource ); //example.xml
generates the following output..
"http://www.publishing.org/namespaces/PriceRequest grammar not found"
Would someone please tell me if the parser is complaining about the defaultNamespace in the XML instance, the targetNameSpace in the xsd or that it cannot find the actual .xsd file?
Thanks,
W. Sean Hennessy