1z0-900 Exam QuestionsBrowse all questions from this exam

1z0-900 Exam - Question 10


Given the code fragment:

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

Show Answer
Correct Answer: BD

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

5 comments
Sign in to comment
kozionov
Dec 7, 2021

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.

ciellaf5Option: C
Sep 17, 2021

Correct is C

peteVlnOption: C
Dec 20, 2023

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-

orjavaOption: C
Jan 7, 2024

Answer C

Galen86Option: B
May 16, 2024

Correct is B