Re: DomXPath and default XML namespaces
| From: | Adam Maccabee Trachtenberg | Date: | Tue, 14 Dec 2004 04:34:11 +0000 |
| Subject: | Re: DomXPath and default XML namespaces | ||
| References: | 1 | Groups: | php.general php.xml.dev |
| Request: | Send a blank email to php-general+get-204269@lists.php.net to get a copy of this message | ||
On Mon, 13 Dec 2004, Dan Phiffer wrote:
> I guess what I would expect to work is to allow for blank values as the
> first argument to registerNamespace, representing the default namespace,
> but that causes the queries to always return no matches. Is there
> something I'm missing with this?
This is an XPath FAQ. Without a ns prefix, XPath doesn't choose
elements living in the default ns, but ones living in no namespace.
Otherwise, you have problems with:
<root>
<foo/>
<foo xmlns="bar"/>
</root>
What would /root/foo be, the first, the second, both? And if this
example is resolvable, what happens to:
<root>
<foo>
<qxx/>
</foo>
<foo xmlns="bar">
<qxx/>
</foo>
</root>
And /root/foo/qxx? Do you select qxx in the default ns? Or not?
-adam
--
adam@trachtenberg.com | http://www.trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!