Get root node of XML doc using simplexml May 15, 2023 by Tarik Are you wanting to get the name of the root node? $xml = simplexml_load_string($str); echo $xml->getName();