Forum und email

SimpleXMLElement->getName()

(PHP 5 >= 5.1.3)

SimpleXMLElement->getName() — Pega o nome de um elemento XML

Descrição

SimpleXMLElement
string getName ( void )

Pega o nome do elemento XML.

Valor Retornado

O método getName retorna uma string com o nome da tag XML referenciada pelo objeto SimpleXMLElement.

Exemplos

Example#1 Pega os nomes dos elementos XML

<?php
 
$sxe 
= new SimpleXMLElement($xmlstr);

echo 
$sxe->getName() . "\n";

foreach (
$sxe->children() as $child)
{
    echo 
$child->getName() . "\n";
}

?>