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='';
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
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
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...
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]
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