Re: [PHP-DEV] unexpected behaviour in SimpleXML (php 5.2.2)

2007-05-24 Thread Caroline Maynard
Vesselin Kenashkov wrote: Here is the first one - how one can find does a SimpleXMLElement has child nodes? Here is an example: $str = ''; $x = new SimpleXMLElement($str); if($x->subnode->children()) print 'yes'; else print 'no'; - will print 'no'; If the $str='';

Re: [PHP-DEV] unexpected behaviour in SimpleXML (php 5.2.2)

2007-05-23 Thread Vesselin Kenashkov
The attribute is not a child XML node. For walking through attributes SimpleXML has $node->attributes() method. And if($node->attributes()) check works as expected. So I think $node->children() must be just for child XML nodes, not for attributes (there is no sense to give back results for attribu

Re: [PHP-DEV] unexpected behaviour in SimpleXML (php 5.2.2)

2007-05-22 Thread kepbepos kepbepos
Hi, I'm not an expert, but in your example $str = ''; $x = new SimpleXMLElement($str); if($x->subnode->children()) print 'yes'; else print 'no'; - will print 'no'; ok no children If the $str=''; it will print yes. ok has one child: But the same will h

Re: [PHP-DEV] unexpected behaviour in SimpleXML (php 5.2.2)

2007-05-22 Thread Vesselin Kenashkov
On 5/22/07, Christian Stocker <[EMAIL PROTECTED]> 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...

Re: [PHP-DEV] unexpected behaviour in SimpleXML (php 5.2.2)

2007-05-22 Thread Christian Stocker
I can't answer on your first topic, but the second: On 22.5.2007 10:23 Uhr, Vesselin Kenashkov wrote: > Hello everybody, > Issue #2: > Xpath on nodes. > Let we have the example: > - > $str = > ''; > > > $x = new SimpleXMLElement($str); > > $r1 = $x->xpath('/*'); > print $r1[0]

[PHP-DEV] unexpected behaviour in SimpleXML (php 5.2.2)

2007-05-22 Thread Vesselin Kenashkov
Hello everybody, Before writing to the dev-list I posted a message in the Zend dev forum (in fact it was an year ago about the same issues), as well on PHP general list, but without any reply or comment. I think two things in the SimpleXML are inconsistent, or at least unexpected from the php dev