The Document Object Model (DOM) is a an standard object model that represents HTML or XML and related formats. Document Object Model is platform as well as language-independent model.
DOM does not supports navigation in any direction
either in the forward direction or in the backward direction but it allows
arbitrary modifications, an implementation must at least buffer the document
that has been read so far. That's the reason that DOM best suits for
applications where the document must be accessed repeatedly or out of sequence
order. In case of strictly sequential and one-pass application, SAX model works
faster and use less memory.
Recommend the tutorial