DOMNode_getNodePath_basic.phpt 365 B

12345678910111213141516171819
  1. --TEST--
  2. DOMNode::getNodePath()
  3. --SKIPIF--
  4. <?php
  5. include('skipif.inc');
  6. ?>
  7. --FILE--
  8. <?php
  9. $file = dirname(__FILE__).'/book.xml';
  10. $doc = new DOMDocument();
  11. $doc->load($file);
  12. $nodes = $doc->getElementsByTagName('title');
  13. foreach($nodes as $node) {
  14. var_dump($node->getNodePath());
  15. }
  16. ?>
  17. --EXPECTF--
  18. string(20) "/books/book[1]/title"
  19. string(20) "/books/book[2]/title"