Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

JAXB Interview Questions and Answers

Ques 1. What Is XML Binding?

Ans. 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
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
• others are only enforced when validation is requested

Is it helpful? Add Comment View Comments
Ques 2. What is XML Binding Relationships?
Ans. 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?
Ans. • 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. JAXB Use Cases.
Ans. • 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?
Ans. • Easy to use
– require minimal XML knowledge
– don’ t require SAX/DOM
• Customizable
– can customize mapping of
XML to Java
• Portable
– can change JAXB implementation
without changing source code
• Deliver soon
– deliver core functionality ASAP
• Natural
– 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 on demand
– validate objects without requiring
• 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:

©2020 WithoutBook