Java XML Online Quiz


Advertisements

Following quiz provides Multiple Choice Questions (MCQs) related to Java XML Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 3 - Which of the following method is used to read contents in SAX parsing?

A - startDocument()

B - characters()

C - startElement()

D - endElement()

Answer : B

Explaination

characters() method is called when character data is encountered and can be used to read contents.

Q 4 - Which of the following class of StAX parser specifies methods for creating an event?

A - XMLEventReader

B - XMLEventWriter

C - Both of the above.

D - None of the above.

Answer : B

Explaination

XMLEventWriter specifies methods for creating an event.

Q 5 - XPath uses a path expression to select node or list of nodes from an xml document.

A - true

B - false

Answer : A

Explaination

XPath uses a path expression to select node or list of nodes from an xml document.

Q 6 - Which of the following XPath expression ensures that selection starts from the current node that match the selection?

A - .

B - /

C - ./

D - //

Answer : D

Explaination

// ensures that selection starts from the current node that match the selection.

Q 7 - Which of the following method of DOM4J Parser builds the DOM4J document from the xml source?

A - SAXReader.read(xmlSource)

B - Dom4j.read(xmlSource)

C - Document.read(xmlSource)

D - Node.read(xmlSource)

Answer : A

Explaination

SAXReader.read(xmlSource) builds the DOM4J document from the xml source.

Answer : C

Explaination

JDOM is an open source, java based library to parse XML document and it is typically java developer friendly API.

Answer : C

Explaination

In both of the above situations, StAX parser is preferred.

java_xml_questions_answers.htm
Advertisements