XML processing in Enterprise Java

XML processing is one of the central technology in almost all the modern enterprise programming language. Over the time, Java language have developed various standards to process XML, choosing the right one become one of the common design decision that enterprise Java developer need to make. 

What is DOM?

DOM represent an XML in a tree structure. There is a one to one mapping between the object in memory and the XML element. As a result, this technique can be very expensive both in terms of memory and CPU resource. 

What is SAX?

SAS is the abbreviation of Simple API XML. It is an event driving XML parsing mechanism. Instead of loading the whole XML into the memory, SAX enable users to write event handlers for specified XML element/attribute, and to process those specific XML events during reading the XML. SAX has much lighter weight memory footprint, because it is only activated when specified XML events are triggered, when the events are rare, it can be significant savings comparing with other XML parsing mechanisms. 

JAXP

JAXP standards Java API for XML Processing. It is an obsolete umbrella term for SAX and DOM. The reason JAXP is obsolete is because JAXP does not have the concept of XML namespace, in modern XML, it is quite often an XML contain multiple namespace. JAXP cannot handle it at all. 

What is StAX?

StAX is the abbreviation for "Streaming API for XML" is a pull streaming model for processing XML documentation. The user cans tart, proceed, pause and resume the XML parsing process. It is suitable for memory and performance are crticial parameters. 

What is JAXB?

JAXB is the abbreviation of Java Architecture for XML Binding. It constitutes a convenient framework for processing XML documents, providing significant benefits as compared to previously available methods such as those based on DOM.