Home >Online Product Documentation >Table of Contents >Obtaining the Name of a Node
The name() function returns a string that contains the tag name of the node, including the namespace prefix, if any.
name()
The following query returns the name of the third element in bookstore, which is "magazine".
bookstore
"magazine"
name(/bookstore/*[3])
An asterisk ( * ) specifies a wildcard name for element names. If there are comments before the third element in the preceding example, this query does not include them in the count. See Filtering Results of Queries.
Remember, an asterisk that is not preceded by an at sign (@) never returns attributes. The XPath processor does not include attributes in node counts. See Attributes and Wildcards.