[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Document is invalid: no grammar found
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|