name of

operator

Return type:
String
Returns:
The argument name.
Syntax
name of (stream-shelf-item | element-expression | element-declaration | entity-declaration)
    


Purpose

The name of operator retrieves the name associated with the specified item.

When the specified item is a stream and it is attached to a file or referent, name of retrieves the name of that file or referent. If the specified stream is input to the SGML or XML parser, name of will retrieve the name of the markup parser.

While parsing SGML or XML, name of can be applied to an element qualifier in order to identify the name of the element, parent element, preparent element, ancestor element, open element, or doctype. For example,

  name of parent
evaluates to the parent element's name, if the current element has a parent. Otherwise it throws an error.

The format item %q is a shorthand for name of element.

When the specified item is an element or entity declaration, name of retrieves the name of that element or entity declaration.

It is an error to invoke name of on a stream that has no name, such as one attached to a buffer. Streams attached to a file, referent, external output, or markup parser do have names. When in doubt, name of should be preceded by the has name test.