note 32255 added to function.xpath-eval
| From: | tuxo at gmx dot net | Date: | Wed, 21 May 2003 16:47:12 +0000 |
| Subject: | note 32255 added to function.xpath-eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48773@lists.php.net to get a copy of this message | ||
PHP Version: 4.3.1
I tried out how to get a part of a xml document with the xpath functions in domxml.
Try the following solution:
<?php
// get dom object
$xmldoc = domxml_open_mem($xml);
// init xpath
$xpath = xpath_new_context($xmldoc);
$xpresult = xpath_eval($xpath, "/root/info");
// dump all nodes directly in plain text
foreach ($xpresult->nodeset as $node)
{
$newxml .= $node->dump_node($node);
}
?>
If you wanna get a new dom object of the result just add
$newxmldoc = domxml_open_mem($newxml);
----
Manual Page -- http://www.php.net/manual/en/function.xpath-eval.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32255
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32255&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32255&report=yes