validation, SAX and DOM

Kay Michael Michael.Kay at
Wed Jul 21 16:51:47 BST 1999

> My question is really, for those of you who are writing XML processors
> (i.e. applications that use XML), what mode(s) do you use, 
> and do you find the need for a validating SAX parser? 

I have to say that I use both modes and I have not yet found much need for a
validating parser of either kind. This is because either (a) I trust the
software that wrote the XML to write valid documents, or (b) I don't trust
it, in which case I invariably need to validate incoming documents against
constraints that I cannot express in a DTD.

It doesn't help that neither SAX nor DOM allows the application to discover
whether validation has been done or not; that XML allows some of the
constraints expressed in a DTD to be overridden in the document instance;
that it's quite difficult to check in my application that the DTD used for
validation was 'the right one'; and with SAX, there is no guarantee of when
validation is done, for example it might give me duplicate ID values and
only report the error at endDocument() time. All these difficulties have led
me in real applications to do full validation at application level and not
trust the parser to do it for me.

Mike Kay

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list