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. How to unmarshall XML into Java objects? Convert from XML to Java objects.
Ans. Example
ObjectFactory factory = new ObjectFactory();
Unmarshaller u = factory.createUnmarshaller();
Cars cars = (Cars) u.unmarshal(new FileInputStream("cars.xml"));
unmarshal method accepts
java.io.File
java.io.InputStream
java.net.URL
javax.xml.transform.Source
related to XSLT
org.w3c.dom.Node
related to DOM
org.xml.sax.InputSource
related to SAX

Other Unmarshaller methods
void setValidating(boolean validating)
true to enable validation during unmarshalling; false to disable (the default)
boolean setEventHandler(ValidationEventHandler handler)
handleEvent method of ValidationEventHandler is called
if validation errors are encountered during unmarshalling
default handler terminates marshalling after first error
return true to continue unmarshalling
return false to terminate with UnmarshalException
see discussion of ValidationEventCollector later
Is it helpful? Yes No

Most helpful rated by users:

©2020 WithoutBook