<<< Previous question <<< Question ID#0631.md >>> Next question >>>
Consider the following simple PHP script:
$dom = new DomDocument();
$dom->load('test.xml');
$xpath = new DomXPath($dom);
$nodes = $xpath->query(???????, $dom->documentElement);
echo $nodes->item(0)->getAttributeNode('bgcolor')->value . "\n";
What XPath query should go in the ?????? above to display the "bgcolor" attribute of the first "body" node in the XML document?
- A) "*[local-name()='body']"
- B) "/body[0]/text"
- C) "/body/body[0]"
- D) "name='body'"
Answer
Answer: A