Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : SimpleXML functions : SimpleXMLElement->getName()

SimpleXMLElement->getName()

Gets the name of the XML element ()

Example 2257. Get XML element names

<?php

$sxe
= new SimpleXMLElement($xmlstr);

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

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

?>

Related Examples ( Source code ) » simplexml element getname






Code Examples / Notes » simplexml element getname

m0sh3

Some unexpected behaviour noticed:
<?php
$root = new SimplexmlElement("<root><parent><child/></parent></root>");
echo $root->parent->child->getName();
?>
"child" is expected, although "parent" is returned


Change Language


Follow Navioo On Twitter
SimpleXMLElement->addAttribute()
SimpleXMLElement->addChild()
SimpleXMLElement->asXML()
SimpleXMLElement->attributes()
SimpleXMLElement->children()
SimpleXMLElement->__construct()
SimpleXMLElement->getDocNamespaces()
SimpleXMLElement->getName()
SimpleXMLElement->getNamespaces()
SimpleXMLElement->registerXPathNamespace()
SimpleXMLElement->xpath()
simplexml_import_dom
simplexml_load_file
simplexml_load_string
eXTReMe Tracker