How to check if TAG exists inside XML with PHP?

[code type=php]
$dom = new DOMDocument();
$dom->load( ‘some.xml’ );

$errorNodes = $dom->getElementsByTagName(‘error’);

if($errorNodes->length == 0)
{
message(‘no error nodes’); // user defined
}

Share and Enjoy !

0Shares
0 0