XML_Unserializer::getRootName PHP Method

getRootName() public method

get the name of the root tag
public getRootName ( ) : string
return string $rootName
    function getRootName()
    {
        if ($this->_root === null) {
            return $this->raiseError('No unserialized data available. ' . 'Use XML_Unserializer::unserialize() first.', XML_UNSERIALIZER_ERROR_NO_UNSERIALIZATION);
        }
        return $this->_root;
    }

Usage Example

 /**
  * Test extracting the root name
  */
 public function testRootName()
 {
     $u = new XML_Unserializer();
     $xml = '<xml>data</xml>';
     $u->unserialize($xml);
     $this->assertEquals('xml', $u->getRootName());
 }
All Usage Examples Of XML_Unserializer::getRootName