Prepare Interview

Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

JAXB Interview Questions and Answers

Experienced / Expert level questions & answers

Ques 1. Customizing Type Bindings.

• Default bindings can be overridden
– at global scope
– on case-by-case basis
• Customizations include
– names of generated package, classes and methods
– method return types
– class property (field) types
– which elements are bound to classes, as opposed to being ignored
– class property to which each attribute and element declaration is bound

Is it helpful? Add Comment View Comments
 

Ques 2. Syntax of customization.

• Customizations can be specified in
– the XML Schema (our focus)
– a binding declarations XML document (not well supported by RI yet)
• The XML Schema must declare
the JAXB namespace and version
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema”
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
jxb:version="1.0">
• Customization elements are placed in annotation elements
<xsd:annotation>
<xsd:appinfo>
binding declarations
</xsd:appinfo>
</xsd:annotation>

Is it helpful? Add Comment View Comments
 

Ques 3. Discuss Customization Levels.

Customizations can be made at four levels
– global
• defined at “top level” in a <jxb:globalBindings> element
• applies to all schema elements in the source schema
and in all included/imported schemas (recursively)
– schema
• defined at “top level” in a <jxb:schemaBindings> element
• applies to all schema elements in the target namespace of the source schema
– definition
• defined in a type or global declaration
• applies to all schema elements that reference the type or global declaration
– component
• defined in a particular schema element or attribute declaration
• applies only to it

Is it helpful? Add Comment View Comments
 

Ques 4. Discuss Global Bindings attributes.

• collectionType
– “indexed” (uses array and provides methods to get/set elements) or fully-qualified-java-class-name(must implement java.util.List)
– default is “java.util.ArrayList”
• enableFailFastCheck
– “true” or “false” (default)
– if true, invalid property values are reported as soon as they are set, instead of waiting until validation is requested
– not implemented yet in RI
• generateIsSetMethod
– “true” or “false” (default)
– if true, generates isSet and unSet methods for the property
• underscoreBinding
– “asCharInWord” or “asWordSeparator” (default)
– if “asWordSeparator” , underscores in XML names are removed and words are camel-cased to form Java name
– for example, “gear_shift_knob” goes to “gearShiftKnob”
• bindingStyle (was modelGroupAsClass)
– “modelGroupBinding” or “elementBinding” (default)
• choiceContentProperty
– “true” or “false” (default)
– allows objects to hold one of a number of property choices which may each have a different data type
• enableJavaNamingConventions
– “true” (default) or “false”
• fixedAttributeAsConstantProperty
– “true” or “false” (default)
– if true, “fixed” attributes will be represented as constants
• typesafeEnumBase
– “xsd:string” , “xsd:decimal” , “xsd:float” , “xsd:double” or “xsd:NCName” (default)
– defines field type used to represent enumerated values in generated typesafe enum class
• typesafeEnumMemberName
– “generateName” or “generateError” (default)
– specifies what to do if an enumerated value cannot be mapped to a valid Java identifier
– “generateName” generates names in the form VALUE_#
– “generateError” reports an error

Is it helpful? Add Comment View Comments
 

Ques 5. What is the syntax of schemaBindings?

• The syntax for the schemaBindings element is
<jxb:schemaBindings>
<jxb:package [name="package-name"]>
<jxb:javadoc> ... javadoc ... </jxb:javadoc>
</package>
<jxb:nameXmlTransform>
<jxb:typeName prefix="prefix" suffix="suffix"/>
<jxb:elementName prefix="prefix" suffix="suffix"/>
<jxb:modelGroupName prefix="prefix" suffix="suffix"/>
<jxb:anonymousTypeName prefix="prefix" suffix="suffix"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
– every element and attribute within schemaBindings is optional

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

Related interview subjects

Core Java interview questions and answers - Total 306 questions
Tomcat interview questions and answers - Total 16 questions
Apache Wicket interview questions and answers - Total 26 questions
Java Applet interview questions and answers - Total 29 questions
JAXB interview questions and answers - Total 18 questions
JMS interview questions and answers - Total 64 questions
Log4j interview questions and answers - Total 35 questions
Struts interview questions and answers - Total 84 questions
RMI interview questions and answers - Total 31 questions
Apache Camel interview questions and answers - Total 20 questions
JDBC interview questions and answers - Total 27 questions
Java 11 interview questions and answers - Total 24 questions
JPA interview questions and answers - Total 41 questions
EJB interview questions and answers - Total 80 questions
GWT interview questions and answers - Total 27 questions
Kotlin interview questions and answers - Total 30 questions
Glassfish interview questions and answers - Total 8 questions
Google Gson interview questions and answers - Total 8 questions
JSP interview questions and answers - Total 49 questions
J2EE interview questions and answers - Total 25 questions
Apache Tapestry interview questions and answers - Total 9 questions
Java Swing interview questions and answers - Total 27 questions
Java Mail interview questions and answers - Total 27 questions
Hibernate interview questions and answers - Total 52 questions
JSF interview questions and answers - Total 24 questions
Java 8 interview questions and answers - Total 30 questions
Java 15 interview questions and answers - Total 16 questions
JBoss interview questions and answers - Total 14 questions
Web Services interview questions and answers - Total 10 questions
RichFaces interview questions and answers - Total 26 questions
Servlets interview questions and answers - Total 34 questions
Java Beans interview questions and answers - Total 57 questions
Spring Boot interview questions and answers - Total 50 questions
JUnit interview questions and answers - Total 24 questions
Spring Framework interview questions and answers - Total 53 questions
Java Design Patterns interview questions and answers - Total 15 questions
©2023 WithoutBook