You need to set the errorHandler on the document builder in order for the
validation to succeed.

Enjoy!

Anish

 -----Original Message-----
From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent:   Monday, June 18, 2001 2:43 PM
To:     [EMAIL PROTECTED]
Subject:        xml validation using xml schemas

Hi, 

I am having problems validating a xml file using xml schemas.

The way I go about it is using the DocumentBuilder. I obtain an instance of
the Document Builder using the DocumentBuilderFactory and simply parse the
XML File. (I am using the personal* sample files)
After turning on the validation, it does in fact validate the  personal.xml
using the personal.dtd. 
However, when I try to parse the personal-schema.xml using the personal.xsd,
it gives me the following error:
Error: URI=null line=3: Element type "personnel" must be declared.

If I use a DOMParser not using the DocumentBuilderFactory, it all works
fine. Anybody know what I am doing wrong?

Thanks a bunch...

Christian

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

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

Reply via email to