Hi Robert!

I guess we have exactly the samt problem.

>In my case to be sure bad XML does not break the SAX handler code I have to
>implement an empty ContentHandler to be run before the real parsing is donne
>just to get hold of validation errors.

What I do is that I don't set any contenthandler at all. I parse the file first
with only a errorhandler installed. Then after a successful parse I install the
contenthandler and parse the file again. Time consuming, I know, but I'll do
for now for me. I have to do this since an element and its value can be read
even if that element is not allowed at that level by the dtd and that means
that endElement() might be called for an element which in fact are not allowed
at that specific level.

>
>Anyway, maybe some of the validation code of Xerces could be improved to
>report wrong order of child elements before their parent is closed.
>This would reduce a lot of responsibility out of any SAX handler code and I
>am not sure if all SAX writers are aware of this as I was not for a long
>time.
>

I too considered this, but I don't have time to modify the code right now, so
I'll probably stick to my earlier solution. I was not aware of the fact that
validation errors are reported when an element is closed and it really gave me
some problems.

//daniel


__________________________________________________________
RFV Data/Produktenheten     E-post: [EMAIL PROTECTED]
Daniel Gr�ndal              Tfn: 060-187126
S:a J�rnv�gsgatan 41        Mobil: 070-3016517
851 93 Sundsvall            Fax: 060-147870
__________________________________________________________



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

Reply via email to