Validation and APIs

David Megginson david at megginson.com
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
tree.


All the best,


David

-- 
David Megginson                 david at megginson.com
           http://www.megginson.com/

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





More information about the Xml-dev mailing list