OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Document is invalid: no grammar found

[ Lists Home | Date Index | Thread Index ]

Jose Airton wrote:
> Hi,
> 
> I created a XML instance : cd.xml and a schema cd.xsd.
> 
> In the begining of cd.xml, it is like the following:
> 
> <cd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:noNamespaceSchemaLocation="file:///c:/cd.xsd">
> 
> when I run parser, it always gives error message:
> 
> "Document is invalid: no grammar found.
> org.xml.sax.SAXParseException: Document is invalid: no grammar found.
> at
> org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:115
> 6)
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
> at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
> at sax.Echo12.main(Echo12.java:43)"
> 
> I'm using j2sdk1.4.0_01.

The odds are very good the schema isn't where you are telling the parser 
to look. Is the schema file really at the top level of your c: drive?

Locate the schema file in a file explorer window. If the path in the 
window is something like C:\a\b then the correct URI is 
"file:///c:/a/b/cd.xsd".

This is an absolute URI. You can also specify it as a relative URI, 
e.g., if the schema is in the same folder as the document, it's relative 
URI is simply "cd.xsd". If it's one folder up, the URI is "../cd.xsd". Etc.

I can't recommend trying out a bunch of invalid URI specifications on 
the theory the parser may be buggy. Figure out a valid one and use that.

Bob Foster





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS