nerdexam
Zend

ZF-100-500 · Question #29

You have given the following XML data in the tasks.XML file: Zend ZF-100-500 Exam <?xml version="1.0" encoding="ISO-8859-1"?> <tasklist> <note> <tasks>Validate data</tasks> <details>String…

The correct answer is C. The contents of every tasks and details nodes. See the full explanation below for the reasoning.

Question

You have given the following XML data in the tasks.XML file: Zend ZF-100-500 Exam <?xml version="1.0" encoding="ISO-8859-1"?> <tasklist> <note> <tasks>Validate data</tasks> <details>String Validation</details> </note> <note> <tasks>Secure data</tasks> <details>Encryption</details> </note> </tasklist> Now, you run the following PHP script: <?php $objDOM = new DOMDocument(); $objDOM->load("tasks.xml"); $note = $objDOM->getElementsByTagName("note"); foreach( $note as $value ) { $tasks = $value->getElementsByTagName("tasks"); $task = $tasks->item(0)->nodeValue; $details = $value->getElementsByTagName("details"); $detail = $details->item(0)->nodeValue; echo "$task :: $detail <br>"; } ?> What should be displayed when this script is executed?

Options

  • AThe contents of the whole XML document
  • BThe XML of every tasks and details nodes
  • CThe contents of every tasks and details nodes
  • DThe XML of whole XML document

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    84% (21)
  • D
    8% (2)

Community Discussion

No community discussion yet for this question.

Full ZF-100-500 Practice