[jdom-interest] Schema validation using Beta 6

Larry Davies Larry_Davies at notes.compaid.com
Fri May 4 08:06:47 PDT 2001


I have seen a number of postings regarding schema validation but it appears as
though nobody has answered the following issue: "Grammar with uri ...".
  I am validating an xml document against a schema.  I am invoking validation by
calling SAXBuilder builder = new SAXBuilder(true).

My XML document reference to my schema is:
<Data xmlns="http://localhost"
             xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
             xsi:schemaLocation="http://localhost mySchema.xsd">

My schema has a declaration like:
<schema xmlns="http://www.w3.org/2000/10/XMLSchema"
        xmlns:cs="http://localhost"
        elementFormDefault="qualified"
        attributeFormDefault="unqualified"
        targetNamespace="http://localhost">

I have verified that these documents are valid, since I validated them using XML
 Spy.

When I run my app, using JDOM Beta 6 and Xerces 1.2.0 ( I am positive that I am
using these two and not another one) I get the following error:

org.jdom.JDOMException: Error on line 2 of document file:ProductData.xml:
General Schema Error: Grammar with uri : http://localhost , can not found.
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java, Compiled Code)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:464)
.
.
.
Root cause: org.xml.sax.SAXParseException: General Schema Error: Grammar with
uri : http://localhost , can not found.
        at
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1008)
        at
org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java,

Compiled Code)
        at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java,

Compiled Code)
        at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java,

Compiled Code)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java,

Compiled Code)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java,

Compiled Code)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java, Compiled Code)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:464)
.
.
.

FYI, I have tried changing my uri to other values, but I have received the same
error every time.

What is this error and how can I fix it?

Thanks.





More information about the jdom-interest mailing list