Hi,
I'm not an expert, but in your example
--------
$str = '<rootnode><subnode></subnode></rootnode>';
$x = new SimpleXMLElement($str);
if($x->subnode->children())
print 'yes';
else
print 'no';
---------
will print 'no';
ok no children
If the
$str='<rootnode><subnode><newnode></newnode></subnode></rootnode>';
it will print yes.
ok has one child: <newnode>
But the same will happen if the subnode has an attribute like:
$str = '<rootnode><subnode id="2"></subnode></rootnode>';
I think is correct, in fact (if I'm right) an attribute is a child.
Following DOM the tree is:
rootnode
|
subnode
|
id
Here an example explaining that
http://www.w3schools.com/dom/nodetree.gif
Please someone else to confirm.
See you