How to check if a TAG name exists inside an XML file.
so if i want to get
$dom->getElementsByTagName('error')
and it does not exist, it outputs something like an error message.
EDIT:
I work from an API. So what happens when a user enters an invalid username, other XML files containing the <error> tag are loaded.
However, if they enter the correct username, the XML file does not contain an <error> , so I'm looking for a way to check if an error tag exists inside XML.
source share