note 93024 added to class.domxpath
| From: | (at) | Date: | Wed, 19 Aug 2009 21:16:12 +0000 |
| Subject: | note 93024 added to class.domxpath | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159662@lists.php.net to get a copy of this message | ||
If your document declares a namespace at all - even just a single default namespace
(xmlns="etc"), you MUST register that namespace with XPath, and you MUST use that
registered namespace in your query. For example:
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://www.whatever.com/">
<foo>
<bar>Text</bar>
</foo>
</document>
//foo will not work - you will not be able to pull data from this document without registering the
default namespace and making up a prefix for it.
If you're attempting to process arbitrary XML documents and you don't know the namespaces
beforehand (as I am in my application), use a bit of regex to pull them out then add them
dynamically.
I think this is pretty silly.
----
Server IP: 209.41.74.194
Probable Submitter: 38.97.88.20
----
Manual Page -- http://www.php.net/manual/en/class.domxpath.php
Edit -- https://master.php.net/note/edit/93024
Del: integrated -- https://master.php.net/note/delete/93024/integrated
Del: useless -- https://master.php.net/note/delete/93024/useless
Del: bad code -- https://master.php.net/note/delete/93024/bad+code
Del: spam -- https://master.php.net/note/delete/93024/spam
Del: non-english -- https://master.php.net/note/delete/93024/non-english
Del: in docs -- https://master.php.net/note/delete/93024/in+docs
Del: other reasons-- https://master.php.net/note/delete/93024
Reject -- https://master.php.net/note/reject/93024
Search -- https://master.php.net/manage/user-notes.php