Validation and APIs

David Megginson david at
Wed Jul 21 14:46:48 BST 1999

Chris Harris writes:

 > This is not to say that you cannot use a validating parser with SAX, in
 > fact all the major parsers provide such capability. It's quite possible to
 > execute all your business logic during the SAX parse, and then throw it
 > away if the parse fails at the end of the document. 

That's pretty much what happens with (most? all?) DOM implementations
behind the scenes.  Remember that the DOM is just one particular (very
generic) type of object model -- instead of working with invoices, or
inventory items, or what have you, you work with elements, attributes,
and text.  A DOM parser typically builds the tree as it goes, and then
presumably discards it all if there is an error.

In any case, even if a document is valid from the XML perspective, its
contents may still violate your business rules, and you might still
have to throw away everything in the middle of walking through a DOM

All the best,


David Megginson                 david at

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