Do SAX and DOM validating parsers take the same amount of memory while validating a document?

Frank Nestel

If you only need to validate a document and not do anything else with it, SAX does it without actually taking memory for the document. Just implement an empty handler which captures all SAX-events and ignores them.

All existing DOM parsers actually seem to be built on top of SAX parsers and a DOM is a very costly (but also valuable at times) data structure in memory. DOM comes in handy if you have to manipulate documents in memory.