Java has a set of XML parsers. Each of these parsers is a standalone XML component that parses an XML document (or a standalone DTD or XML Schema) so that it can be processed by an application.
Java Dom parser api for xml is intended for working with XML as an object graph (a tree like structure) in memory – so called "Document Object Model (DOM)".
Dom parser traverses the input XML file and creates DOM objects corresponding to the nodes in XML file. These DOM objects are linked together in a tree like structure. Once the parser is done with parsing process, you get this tree-like DOM object structure back from it. Now you can traverse the DOM structure back and forth as you want to get/update/delete data from it.
Sax, or Simple Api for xml is an event-driven model (you provide the callback methods, and the parser invokes them as it reads the XML data), and that makes it harder to visualize. Finally, you cannot "back up" to an earlier part of the document, or rearrange it, any more than you can back up a serial data stream or rearrange characters you have read from that stream.
StAX parser was created to address limitations in the two most prevalent parsing APIs, SAX and DOM. The primary goal of the StAX API is to give "parsing control to the programmer by exposing a simple iterator based API. This allows the programmer to ask for the next event (pull the event) and allows state to be stored in procedural fashion."