Thanks, thats what I'm seeing.
I can use SAXParser to validate ignoring the DTD but not Validator.

David A. Lee
d...@calldei.com
http://www.xmlsh.org


On 9/17/2010 12:03 PM, Michael Glavassevich wrote:

Hi David,

What you are seeing may be due to the combination of features you are setting. If you are enabling both the Xerces' specific 'validation' and 'schema validation' features the behaviour may surprise you. What happens when the document also has a DTD is described in this FAQ [1]. I've never liked what Xerces does in this case, but it's been the behaviour for a long time, so too late to change it.

If you want schema validation and schema validation only I would suggest that you do it using JAXP [2] which has features / APIs for validation against specific schema languages.

Thanks.

[1] http://xerces.apache.org/xerces2-j/faq-pcfp.html#faq-3
[2] http://xerces.apache.org/xerces2-j/faq-pcfp.html#faq-4

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

David <d...@calldei.com> wrote on 09/17/2010 11:46:57 AM:

> I'm trying to use the Validator class to validate XML documents
> againts a supplied XSD file.
> I was having problems with getting no errors on obvioulsy invalid
> XML.  I have tracked it down to DTD processing.
> IF I have an XML document with a DOCTYPE  like this:
>
> <!DOCTYPE PLAY SYSTEM "play.dtd">
>
> And the document validates against the DTD,  the Validator seems to
> be ignoring the schema I pass in.  If I remove the DOCTYPE then the
> Validator accepts the schema and properly reports errors.
> Interestingly, if instead of Validater I use the SAXParser and then
> set the schema properties it works as expected and validates using
> my supplied XSD reguardless of if there is a DTD present.
>
>
>
> I can provide full code if useful.   Does this ring a bell to anyone
> ? Is there a feature or property I must set to tell Validator to use
> my XSD even if there is a DTD present in the XML ?
>
> Thanks for any suggestions.
>
>
> --
> David A. Lee
> d...@calldei.com
> http://www.xmlsh.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to