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]

Reply via email to