I am a newcomer to PHP and SimpleXMl.
I would not expect false under either of these tests.
$xml=new SimpleXMLElement('<a><b>123</b></a>');
var_dump($xml);
echo $xml ? "true": "false";
or
$xml=new SimpleXMLElement('<a><b></b></a>');
var_dump($xml);
echo $xml ? "true": "false";
however the second returns false even though an XMLSimpleElement object is returned. I have the same issue with an xml doc with namespaces everywhere.
it means I cannot test for a failed XML parsing as
if (!xml)
returns false
but $xml->childen($namespace)
does not.
Please advise TIA Ephraim