DomXPath and default XML namespaces

From: Date: Tue, 14 Dec 2004 03:56:16 +0000
Subject: DomXPath and default XML namespaces
Groups: php.general php.xml.dev 
Request: Send a blank email to php-general+get-204267@lists.php.net to get a copy of this message
I'm curious whether it's possible to use the DomXPath->query in such a way that this... <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
        <div>Foo</div>
    </body>
</html> .. could be accessed like this: $xp = new DomXPath($domdoc); echo $xp->query("/html/body/div")->item(0)->nodeValue; ... instead of like this: $xp = new DomXPath($domdoc); $xp->registerNamespace('html', 'http://www.w3.org/1999/xhtml'); echo $xp->query("/html:html/html:body/html:div")->item(0)->nodeValue; 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? Thanks! -Dan

« previous php.general (#204267) next »