Hello John,

You need to turn on schema validation [1] as well otherwise the parser
will try to validate against a DTD.

Try adding this to your code:

parser.setFeature("http://apache.org/xml/features/validation/schema";,
true);

Hope that helps.

[1] http://xml.apache.org/xerces2-j/features.html#validation.schema

On Wed, 11 Feb 2004, Hoebel, John wrote:

> I am trying to validate a xml document with a schema using an external
> schema in Java:
>
>     20           String schemaURI = "file:///test.xsd";
>     21           DOMParser parser = new DOMParser();
>     22
> parser.setFeature("http://xml.org/sax/features/validation";, true);
>     23           parser.setProperty(
>     24
> "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocat
> ion",
>     25              schemaURI);
>
> I get:
>
> [Error] :1:23: Document is invalid: no grammar found.
> [Error] :1:23: Document root element "XXXX_INTERVAL_REQUEST", must match
> DOCTYPE root "null"
>
> I have tried different formats for the different schema uri value. None
> make a difference.
>
> I am using Xerces-J-bin.2.6.1 version.
>
> Any suggestions? I would appreciate any help.
>
> Thanks,
> John
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-- 
---------------------------
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to