[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Document is invalid: no grammar found


cd.xsd
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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.