I could not find answer for this question , could anybody please let me know
Since JAXB is an higher level API , does JAXB uses SAX or DOM internally ?
JAXB allows applications to access the data in the XML from the object rather than using the DOM or SAX to retrieve the data from a direct representation of the XML itself. It is most often used alongside Java API for XML Web Services (JAX-WS) and makes objects creation and mapping easy.
JAXB is not directly comparable to DOM and SAX. The Java DOM and SAX parsing APIs are lower-level APIs to parse XML documents, while JAXB (Java API for XML Binding) is a higher-level API for converting XML elements and attributes to a Java object hierarchy (and vice versa).
JAXB simplifies access to an XML document from a Java program by presenting the XML document to the program in a Java format. The first step in this process is to bind the schema for the XML document into a set of Java classes that represents the schema.
Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB 2 (JSR-222) expert group.
Individual JAXB (JSR-222) implementations are free to choose the underlying parsing technologies they use for different inputs. The strategy we use in MOXy is to use StAX (javax.xml.stream) as much as possible.
There are ways to control what parser your JAXB impl uses. Below is a link to an answer I gave explaining how to get a JAXB impl to use a specific SAX parser:
And another answer explaining how to ensure that StAX is used:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With