Exam 1z0-900 All QuestionsBrowse all questions from this exam
Question 10

Given the code fragment:

Which method should be used on line 3 to enable default validation mechanism?

    Correct Answer: B

    To enable the default validation mechanism in JAXB, you should use the setSchema method. The setValidating method is deprecated, and using setEventHandler is for handling validation events but does not enable the default validation mechanism. Therefore, the correct method to use is setSchema(Schema).

Discussion
kozionov

There is no correct answer! Correct is setValidating(true) or setSchema(javax.xml.validation.Schema) because method setValidating(true) is deprecated. https://docs.oracle.com/javaee/7/api/javax/xml/bind/Unmarshaller.html#:~:text=By%20default%2C%20the%20Unmarshaller%20does,one%20of%20the%20unmarshal%20methods.

Galen86Option: B

Correct is B

orjavaOption: C

Answer C

peteVlnOption: C

It seems that C is the correct answer. https://docs.oracle.com/javase/8/docs/api/javax/xml/bind/helpers/AbstractMarshallerImpl.html#setEventHandler-javax.xml.bind.ValidationEventHandler-

ciellaf5Option: C

Correct is C