Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18225 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 399 invoked by uid 1010); 19 Aug 2005 18:02:09 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 384 invoked from network); 19 Aug 2005 18:02:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Aug 2005 18:02:09 -0000 X-Host-Fingerprint: 216.239.128.146 dev03.omnis.com Received: from ([216.239.128.146:4295] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 06/03-33075-E9E16034 for ; Fri, 19 Aug 2005 14:02:06 -0400 Message-ID: <06.03.33075.E9E16034@pb1.pair.com> To: internals@lists.php.net Date: Fri, 19 Aug 2005 11:08:10 -0700 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <43054765.3000208@lerdorf.com> <24e5f3b705081823422adb289c@mail.gmail.com> <4305833A.5070407@lerdorf.com> In-Reply-To: <4305833A.5070407@lerdorf.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 216.239.128.146 Subject: Re: [PHP-DEV] Simplexml and xml namespaces From: johnjawed@gmail.com (john) Long time reader, first time poster. Rasmus, I noticed your var_dump says $x->node->title is of string(6) ... though I count only 5. Just wondering, a simple typo or something more involved? Regards, John Rasmus Lerdorf wrote: > Sterling Hughes wrote: > >>Hm - that shouldn't be. >> >>I think the right solution is that media:title should not show up in >>the children of node, unless you are looking at the proper namespace, >>ie, you need to use children() to get the children in that namespace. > > > Ah, you are right. It's the damn var_dump() problem again. > eg. > > $xml = << > > Title > Media Title > > > EOF; > $x = simplexml_load_string($xml); > > var_dump($x->node) shows: > > object(SimpleXMLElement)#2 (1) { > ["title"]=> > array(2) { > [0]=> > string(6) "Title" > [1]=> > string(11) "Media Title" > } > } > > but var_dump($x->node->title) shows: > > object(SimpleXMLElement)#4 (1) { > [0]=> > string(6) "Title" > } > > There should be a simplexml_dump() or something along those lines and > perhaps even a warning in var_dump() when it tries to dump an object > that has its own iterator. > > -Rasmus