(PHP5) Getting parent node from a DOMnode object
| From: | Siddharth Hegde | Date: | Sun, 18 Jul 2004 13:22:09 +0000 |
| Subject: | (PHP5) Getting parent node from a DOMnode object | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-190909@lists.php.net to get a copy of this message | ||
Hello everyone,
I am usinng the following code to convert an xpath to a node. I was
wondering if there is any way I can get the parent node of $node from
the code below. Is there any other way that I can convert the xpath to
the corresponding parent node?
<?
// Code for loading $dom_doc comes here
$xpath = new DOMXPath($dom_doc);
$path = $xpath->query($path);
$node = $path->item(0); // Get the first node always
?>
Any help will be appreciated.
Thanks
- Sid