GoLang DOMNode::getNodePath

request it (130)
GoLang replacement for PHP's DOMNode::getNodePath [edit | history]

Do you know a GoLang replacement for PHP's DOMNode::getNodePath? Write it!

PHP DOMNode::getNodePath

PHP original manual for DOMNode::getNodePath [ show | php.net ]


(PHP 5 >= 5.2.0, PHP 7)

DOMNode::getNodePathGet an XPath for a node


public string DOMNode::getNodePath ( void )

Gets an XPath location path for the node.


This function has no parameters.

Return Values

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


Example #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";

The above example will output:


See Also