Java / JAXB
1. What is JAXB?
Java Architecture for XML Binding (JAXB) provides a fast and convenient way to bind XML schemas and Java representations, making it easy for Java developers to incorporate XML data and processing functions in Java applications. JAXB provides methods for unmarshalling...
2. Explain the JAXB architecture.
JAXB architecture consists of 3 components. Schema compiler binds a source schema to a set of schema-derived program elements....
3. What is Unmarshalling in JAXB?
Unmarshalling refers to the process of converting XML data into JAXB-derived Java objects.
4. What is marshalling in JAXB?
Marshalling provides a client application the ability to convert a JAXB-derived Java object tree into XML data.
5. What is the default encoding for generating XML in JAXB?
UTF-8.
6. What is XML binding in JAXB?
XML binding is the representation of XML document content as an object in computer memory. At compile time, a schema driver processes the XSD and generates an execution object model (XOM)....
7. Difference between DTD and XML Schema.
DTD is not written using XML while XML schema are xml documents in itself.DTD stands for Document Type definition, a legacy way to define structure of XML documents. XML schema offers more types to map different types of data in...
8. Difference between JAXB and DOM/SAX.
The Java DOM and SAX parsing are lower-level APIs to parse XML documents, while JAXB is a higher-level API for converting XML elements and attributes to a Java object hierarchy (and vice versa). Implementations of JAXB may use a DOM...
9. Difference between JAXP and JAXB.
JAXP (Java API for XML Processing) refers to the outdated low-level XML APIs in JavaSE, such as DOM, SAX and StAX. JAXB (Java Architecture for XML Binding) uses annotations to bind XML documents to a java object model.
10. Steps involved in JAXB marshaling or Java object to XML conversion.
Create POJO class and add JAXB annotations. Annotate with @XmlRootElement @XmlAccessorType and annotate all fields with @XmlElement....