Use SAX if -
You can extract all that you need in one pass. While processing the elements, you dont need to "look back" at the ancestor elements. Use DOM if -
You need to have random access to different parts of the document. Your processing logic requires traversing the document more than once, possibly with different starting points. The processing logic is likely to modify the original document by adding/removing/moving elements. The processing involves creating new documents in memory. As you can see, SAX and DOM has their own plus points. Performance is another thing
you should consider. Since DOM parsing creates an image of the document in memory, it consumes more resources. SAX on the otherhand is really lightweight and provides very good response time for large documents( > 1MB ), but it is not as flexible as DOM is.
It is not unusual for applications to use both DOM and SAX parsing depending on
what is being done with the XML document.
Hope that helps.