Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

JAXB Interview Questions and Answers

Ques 1. What Is XML Binding?

Maps XML to in-memory objects according to a schema. Generates classes to represent XML elements so developers don't have to write them the binding compiler does this the classes follow JavaBeans property access conventions. Supports three primary operations: 

  • Marshalling a tree of objects into an XML document
  • Unmarshalling an XML document into a tree of objects
  • Includes validation of the XML against the schema 
It is used to generate the classes of the objects validation of object trees against the schema used to generate their classes. Some constraints are enforced while working with the objects and others are only enforced when validation is requested.

Is it helpful? Add Comment View Comments
 

Ques 2. What is XML Binding Relationships?

The relationships between the components involved in XML binding (data binding) are shown below:

schema > classes < objects < > XML > schema
  • Schema generates classes.
  • Objects are instanceof classes.
  • Marshal from objects to XML.
  • Unmarshall from XML to objects.
  • XML validates and conforms to Schema.

Is it helpful? Add Comment View Comments
 

Ques 3. Why Use XML Binding?

  • It's not necessary. Everything that must be done with XML can be done with SAX and DOM.
  • It's easier, don't have to write as much code, don't have to learn SAX and/or DOM.
  • It's less error-prone, all the features of the schema are utilized, don't have to remember to manually implement them.
  • It can allow customization of the XML structure unlike XMLEncoder and XMLDecoder in the java.beans package.

Is it helpful? Add Comment View Comments
 

Ques 4. Please explain JAXB Use Cases.

  • Create/Read/Modify XML using Java but without using SAX or DOM.
  • Validate user input using rules described in XML Schemas.
  • Use XML-based configuration files, access their values, write tools that creates and modifies these files.

Is it helpful? Add Comment View Comments
 

Ques 5. What are the goals of JAXB?

  • Easy to use require minimal XML knowledge, don't require SAX/DOM knowledge.
  • Customizable can customize mapping of XML to Java.
  • Portable can change JAXB implementation without changing source code.
  • Deliver soon, deliver core functionality ASAP.
  • Follow standard design and naming conventions in generated Java.
  • Match schema, easy to identify generated Java components that correspond to schema features.
  • Hide plumbing encapsulate implementation of unmarshalling, marshalling and validation.
  • Validation, on demand validate objects without requiring marshalling.
  • Preserve object equivalence (round tripping), marshalling objects to XML and unmarshalling back to objects results in equivalent objects.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2024 WithoutBook