The following are some suggestions for when to use DOM.
If random access to information is crucial, it is better to use the DOM to create a tree structure for the data in memory. When you use SAX, the document is not in memory. Therefore, you must handle data in the order in which it is processed. SAX can be difficult to use when the document contains many internal cross-references, such as ID and IDREF attributes. DOM stores the document in memory and allows you to access its parts without reading the entire document.
It is your responsibility to maintain data structures holding context information that you must retain, such as the attributes of the current element's ancestor.
SAX support is not built into Microsoft® Internet Explorer.
The DOM works better for XSL Transformations (XSLT) where the source XML document is transformed based on the XSLT template applied. For example, to create multiple views of the same data, you must transform it using one of two style sheets. In order for this transformation to take place, you must also create two instances of the DOM. One stores the XML source; the other stores the transformed content.
Use the DOM if you must perform complex XML Path Language (XPath) filtering and retain complex data structures that hold context information. The tree structure of the DOM retains context information automatically. With SAX, you must retain the context information yourself.
The DOM allows you to create or modify a document in memory, as well as read a document from an XML source file. SAX is designed for reading, not writing, XML documents. The DOM is the better choice for modifying an XML document and saving the changed document to memory.