Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c

From: Date: Mon, 01 Dec 2003 21:52:09 +0000
Subject: Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_API.c
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-5952@lists.php.net to get a copy of this message
Hello Adam, Monday, December 1, 2003, 6:51:38 PM, you wrote: > On Mon, 1 Dec 2003, Stanislav Malyshev wrote: >> AMT>> $s = simplexml_load_file('file.xml'); >> AMT>> $s->person->xsearch('/my/xpath/query'); >> >> This makes fetch for read. > I'm with Andi and George. We should just fix SimpleXML to return > strings instead of objects when there are no descendant nodes. > Then, $s->person would return an object if there were other nodes to > examine and a string if it was the leaf. That's a worse thing because that is really magic. So when you traverse a xml document you have no idea what you will get. And also how do i get the text content of an element then? I've posted my ideas alread. Allow (string)$obj casting or provide a second object handler that only works for printing with the __toString and we are done. (The latter is my favorite of course). -- Best regards, Marcus mailto:helly@php.net

« previous php.internals (#5952) next »