You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Kenneth Lee <ke...@alfacomtech.com> on 2000/10/04 09:27:30 UTC

Confused with validation

Hi all,

I just begin with Xerces, and after skimmed thru the FAQ and Docs, 
and write some code snippet for experiments, I still can't figure out 
what validation actually means in Xerces.

In my testing codes, I turned on the validation features, both 
http://xml.org/sax/features/validation and 
http://apache.org/xml/features/validation/dynamic, 
but seems I can still have any arbitrary elements in my XML 
file, without defining them in the DTD. (Not test with schema yet)
I know the parser really parsed the DTD, I see the default 
attributes, normalization, entity substitution, etc.

Look forward to your precious pointers.

Thanks in advance.
Kenneth



Re: Confused with validation

Posted by Andy Clark <an...@apache.org>.
Kenneth Lee wrote:
> In my testing codes, I turned on the validation features, both
> http://xml.org/sax/features/validation and
> http://apache.org/xml/features/validation/dynamic,
> but seems I can still have any arbitrary elements in my XML
> file, without defining them in the DTD. (Not test with schema yet)
> I know the parser really parsed the DTD, I see the default
> attributes, normalization, entity substitution, etc.

Don't confuse not seeing errors as meaning that it's not doing
validation. To see the errors, you have to implement and register
an ErrorHandler. By default, the parser will only stop when it
sees a fatal error -- something not well-formed in the document;
validation errors are not fatal and the parser will continue.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org