Re: unexpected behaviour in SimpleXML (php 5.2.2)
| From: | Vesselin Kenashkov | Date: | Tue, 22 May 2007 10:11:41 +0000 |
| Subject: | Re: unexpected behaviour in SimpleXML (php 5.2.2) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-29656@lists.php.net to get a copy of this message | ||
On 5/22/07, Christian Stocker <christian.stocker@liip.ch> wrote:
I can't answer on your first topic, but the second: That's how it works also in ext/dom (and IMHO as it's supposed to work), but the "workaround" is easy: $r2 = $z->xpath('./*');Thank for looking and replying. I have to clarify... Actually I would expect at least the third example ------------- $z = clone $x->level1_node1[0]; $r3 = $z->xpath('/*'); print $r3[0]->getName();//prints rootnode ------------- to print level1_node1. But as well at least to me looks logical even the second to print level1_node1, because the xpath() method is acalled on the level1_node1, not the rootnode. I think that it is incorrect that the object (the xml strcuture) $z is still treated like the object $x when it comes to Xpath. In fact they are different object with different structures and the Xpath expressions must return different results (IMHO). works as you would expect it.
chregu -- christian stocker | Liip AG | schoeneggstrasse 5 | ch-8004 zurich phone +41 44 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.liip.ch/ | christian.stocker@liip.ch | GnuPG 0x5CE1DECBVesselin Kenashkov P.S. sorry for the double post - reply issue.