API16

JXMLElement/name

From Joomla! Documentation

< API16:JXMLElement

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Get the name of the element. Warning: don't use getName() as it's broken up to php 5.2.3



Syntax[edit]

name()


Returns[edit]

string

Defined in[edit]

libraries/joomla/utilities/xmlelement.php

Importing[edit]

jimport( 'joomla.utilities.xmlelement' );

Source Body[edit]

public function name()
{
        if(version_compare(phpversion(), '5.2.3', '>'))
        {
                return (string)$this->getName();
        }

        // workaround php bug number 41867, fixed in 5.2.4
        return (string)$this->aaa->getName();
}



Examples[edit]

Code Examples[edit]

Get the name of the document

demo.xml

<jdoc>
	<doku kategory="Info">Wiki</doku>
</jdoc>
<?php

$xml = JFactory::getXML('demo.xml');

echo $xml->name();

Output:

jdoc

Elkuku 11:02, 14 January 2011 (CST) Edit comment