DomXPath and default XML namespaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux