PHP 7.4.9 Released!


(PHP 5 >= 5.2.0, PHP 7)

DOMNode::getNodePathGet an XPath for a node


public DOMNode::getNodePath ( void ) : string

Gets an XPath location path for the node.


Esta função não possui parâmetros.

Valor Retornado

Returns a string containing the XPath, or NULL in case of an error.


Exemplo #1 DOMNode::getNodePath() example

// Create a new DOMDocument instance
$dom = new DOMDocument;

// Load the XML
  <apple>granny smith</apple>

// Print XPath for each element
foreach ($dom->getElementsByTagName('*') as $node) {
$node->getNodePath() . "\n";

O exemplo acima irá imprimir:


Veja Também

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top