JAXB is an acronym of Java Architecture for XML Binding.
- JAXB provides API to access and process a XML document.
- We can read or write XML files using JAXB.
- SAX and DOM are generic XML parsers& they will parse any well-structured XML.
- JAXB creates a parser that is specific to your DTD.
- A JAXB parser will parse only valid XML (as defined by your DTD).DOM and JAXB both produce a tree in memory.
- DOM produces a generic tree, everything is a Node.JAXB produces a tree of Objects with names and attributes as described by your DTD.
Features of JAXB :
- Ease of development
- Typed access to XML content
- Leverage Java SE 5 features
- 100% XML Schema support
- Java classes to XML Schema binding
- Data binding for Java API for XML Web Services (JAX-WS)
- Schema evolution
- Provide optional on-demand validation of XML documents
- Hides the complexity of DOM/SAX APIs
- Is portable (A JAXB application should be able to utilize different JAXB implementations by just regenerating the schema classes and doesn't require change to the actual application code.)