note 51480 added to function.dom-domxpath-registernamespace
| From: | spam at spam dot spam | Date: | Thu, 31 Mar 2005 20:46:30 +0000 |
| Subject: | note 51480 added to function.dom-domxpath-registernamespace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87290@lists.php.net to get a copy of this message | ||
It is mentioned in a few places on the web, but it wasn't mentioned here. You need to use this
function to set up a prefix for the default namespace of a document.
For instance, if you are trying to parse a Microsoft Spreadsheet XML file, which has the default
namespace of "urn:schemas-microsoft-com:office:spreadsheet":
$doc = DOMDocument::load("my_spreadsheet.xml);
$xpath = new DOMXPath($doc);
$xpath->registerNamespace("m",
"urn:schemas-microsoft-com:office:spreadsheet");
$query = '/m:Workbook/m:Worksheet[1]/m:Table';
$result = $xpath->query($query, $doc);
You can use anything in place of the 'm', but you have to specify something! Just asking
for "/Workbook/Worksheet/Table" doesn't work.
----
Manual Page -- http://www.php.net/manual/en/function.dom-domxpath-registernamespace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51480
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51480&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51480&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51480&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51480&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51480&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51480&report=yes
Search -- http://master.php.net/manage/user-notes.php