You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Minh Kama Yie <mi...@nuix.com.au> on 2001/11/19 08:29:30 UTC

Error parsing a valid XML Schema

Hi all,

I'm trying to parse a XML Schema document that is validated succesfully at 
the url: 
http://www.w3.org/2001/03/webdata/xsv

I'm using xerces 1.4.3 and running sun's jdk 1.3.1 on a linux box.
I'm currently doing a fairly simple parsing process, just:

            DocumentBuilderFactory builderFactory =  
DocumentBuilderFactory.newInstance();

            builderFactory.setValidating(true);

            builderFactory.setNamespaceAware(true);
            
            DocumentBuilder docBuilder = builderFactory.newDocumentBuilder(); 
         
            docBuilder.setErrorHandler(new MyHandler());            
            
            Document w3cDoc = docBuilder.parse(new InputSource(new 
StringReader(xsdString)));


However in doing this I generate the following error. From what I understand 
from reading the source code, it is a result of not being able to resolve the 
grammar for the xsd namespace, and the namespace keys in the list for the 
grammar resolver is empty. I can't quite interpret what to do about this 
however.

org.xml.sax.SAXParseException: General Schema Error: Grammar with uri: 
http://www.w3.org/2001/XMLSchema , can not be found; schema namespace may be 
wrong:  Xerces supports schemas from the "http://www.w3.org/2001/XMLSchema" 
namespace or the instance document's namespace may not match the 
targetNamespace of the schema.
	at org.apache.xerces.framework.XMLParser.reportError(Unknown Source)
	at 
org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1751)
	at 
org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3156)
	at 
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1159)
	at org.apache.xerces.framework.XMLDocumentScanner.scanElement(Unknown Source)
	at 
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(Unknown 
Source)
	at org.apache.xerces.framework.XMLDocumentScanner.parseSome(Unknown Source)
	at org.apache.xerces.framework.XMLParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
	...

Would anyone know what I'm doing wrong? I've got a feeling its something 
bleeding obvious that I've missed....

Thanks in advance guys.

-- 
Regards, 

Minh Kama Yie
Nuix

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org