A mechanism for validating a message, such as an XML message or other
hierarchically-organized content. A validation engine walks through the
tree represented by the message preferably in depth-first traversal
order. Upon encountering each node in the tree, the validation engine
consults a validation table to identify a delegate that is to be invoked.
The validation engine then invokes the delegate identified for that node,
and calls itself recursively on the subtrees of the current node. After
the subtrees have been processed, the validation engine again consults
the validation table to identify a post-handler for the current node, and
then invokes the post-handler. An entry in the validation table may be
flagged as "exclusive" to prevent traversal of subtrees of the node
corresponding to that entry. Additionally, there may be both global and
local validation tables, where the global table is used when a node has
no entry in the local table.