[
Lists Home |
Date Index |
Thread Index
]
I found this solution:
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
xmlReader.setFeature("http://apache.org/xml/features/validation/schema",
true);
----- Original Message -----
From: "Jose Airton" <jairtonf@yahoo.com.br>
To: <xml-dev@lists.xml.org>
Sent: Sunday, March 28, 2004 2:05 PM
Subject: [xml-dev] Document is invalid: no grammar found
> 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.
>
> Thanks in advance,
>
> jairton.
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
|