Re: PHP5, XPath and count()

From: Date: Sat, 24 Jul 2004 15:35:59 +0000
Subject: Re: PHP5, XPath and count()
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-191741@lists.php.net to get a copy of this message
Christian Stocker wrote:
var_dump($xpath->query("count(/catalog/cd")->item(0));
this doesn't work yet in DOM. The returned value has to be a nodeset. Will be fixed some day ;)
Thanks, both Jason and Christian I found something else that I think is strange. $dom = new DOMDocument(); $root = $dom->createElement("test"); $dom->appendChild($root); $node = $dom->createElement("foo", "which entities <i>does</i> it escape & which doesn't it?"); $root->appendChild($node); echo $dom->saveXML(); The result will be: <?xml version="1.0"?> <test><foo>which entities &lt;i&gt;does&lt;/i&gt; it escape </foo></test> It stops at the &, which I think is strange. It escapes the < to &lt; and > to &gt;, but not & to &amp;. It would be better if it escaped none or all entites that "can do harm". Or what do you think? regards, Victor

« previous php.general (#191741) next »