xpath_domnamespacenode.phpt 758 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. DOMXPath::query() can return DOMNodeList with DOMNameSpaceNode items
  3. --FILE--
  4. <?php
  5. $xml = <<<'XML'
  6. <?xml version="1.0" encoding="UTF-8"?>
  7. <test></test>
  8. XML;
  9. $doc = new DomDocument;
  10. $doc->loadXML($xml);
  11. $xpath = new DOMXPath($doc);
  12. $nodes = $xpath->query('//namespace::*');
  13. var_dump($nodes->item(0));
  14. ?>
  15. --EXPECT--
  16. object(DOMNameSpaceNode)#3 (8) {
  17. ["nodeName"]=>
  18. string(9) "xmlns:xml"
  19. ["nodeValue"]=>
  20. string(36) "http://www.w3.org/XML/1998/namespace"
  21. ["nodeType"]=>
  22. int(18)
  23. ["prefix"]=>
  24. string(3) "xml"
  25. ["localName"]=>
  26. string(3) "xml"
  27. ["namespaceURI"]=>
  28. string(36) "http://www.w3.org/XML/1998/namespace"
  29. ["ownerDocument"]=>
  30. string(22) "(object value omitted)"
  31. ["parentNode"]=>
  32. string(22) "(object value omitted)"
  33. }