Change the URI from http://www.w3.org/2000/10/XMLSchema-instance to 
http://www.w3.org/2001/XMLSchema-instance in the XML file/InputSource. Also the 
URI in schema file should be http://www.w3.org/2001/XMLSchema.

Cheers,
Rahul.

> From: Christians Izquierdo <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: Question about schema validation
> Date: Sat, 7 Jul 2001 10:58:24 -0600 
> 
> Hi,
> 
> I've not been able to validate an XML document against its schema using
> Xerces 1.4.0. The code I'm using is:
> 
>       // Create a validating DOM Parser.
>       DOMParser parser = new DOMParser();
>  
> parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion";
> , true );
>       parser.setFeature("http://xml.org/sax/features/validation";
> , true );
>       parser.setFeature("http://xml.org/sax/features/namespaces";
> , true );
>       parser.setFeature("http://apache.org/xml/features/validation/schema";
> , true );
>  
> parser.setFeature("http://apache.org/xml/features/validation/schema-full-che
> cking", true );
> 
> 
>       // Catch any parse exceptions.
>       parser.setErrorHandler(this);
> 
>      InputSource source = new InputSource(new
> StringReader(validatingParameters));
> 
>       source.setSystemId("file:///e:/test/xml/report-parameter-list.xsd");
> 
>       // Parse XML file and check for errors.
>       parser.parse("<?xml version='1.0' encoding='UTF-8'?><report
> xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
> xsi:noNamespaceSchemaLocation='report-parameter-list.xsd'><system-properties
> alias='TestReport' name='A Test Report'/></report>");
> 
> This code when  executed throws the error:
> 
> Invalid report-parameters: Element type "report-parameters" must be
> declared.
> 
> Now if I copy the XML document in XMLSpy it validates against the schema
> with no errors.
> 
> What am I doing wrong?
> 
> Thanks for your help,
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 






Make everything as simple as possible but no simpler

         ______
        /_____/\         Rahul Srivastava
       /____ \\ \        Member Technical Staff, Javasoft
      /_____\ \\ /       Sun Microsystems India Pvt. Ltd.
     /_____/ \/ / /      5th Floor, Divyasree Chambers,
    /_____/ /   \//\     Off Langford Road, Shanthinagar,
    \_____\//\   / /     Banglore - 560025
     \_____/ / /\ /
      \_____/ \\ \       Ph: 91-80-2298989/2295412 Extn: 87379
       \_____\ \\
        \_____\/         E-Mail: [EMAIL PROTECTED]

visit us at http://java.sun.com


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

Reply via email to