LocalName (XmlDoc/XmlNode function)
LocalName returns the "local name" (the name ignoring any prefix and colon) of the node that is the head of an XPath result.
%unicode = nr:LocalName[( [xpath])] Throws XPathError
|%unicode||A Unicode string variable for the returned name.|
|nr||An XmlDoc or XmlNode, used as the context node for the xpath expression. If an XmlDoc, the Root node is the context node.|
|xpath||A Unicode string that is an XPath expression that results in a nodelist. The head of the nodelist is the node to process. Any other nodes in the nodelist are ignored.
This is an optional argument, and its default is a period (.), that is, the node referenced by the method object (nr).
- The local name is defined to be:
- The local part of the element-type or attribute name, if the node is an Element or Attribute, respectively. This does not include any namespace prefix or following colon.
- The processing instruction's target, if the node is a PI. (A PI node does not have a namespace prefix.)
- Other node types will return the null string.
- This function may only be used if the XmlDoc's Namespace property is On.
- As of Sirius Mods Version 7.3, LocalName's argument and result may include only non-null EBCDIC characters that translate to Unicode. As of Sirius Mods Version 7.6, these strings are Unicode or are converted to Unicode.
In the following example, the part of the first name after the colon, and the entire second name (which does not have a prefix) are printed:
begin %d oject xmlDoc %d = new %n1 object xmlNode %n1 = %d:addElement('foo:bar', , 'ftp:here') Print %n1:LocalName< %n1 = %n1:AddElement('junk') Print %n1:LocalName end
The example result follows:
This list is not exhaustive: it does not include all the errors that are request cancelling.
- XmlDoc Namespace property value not On
- The xpath expression is invalid.
- Result of xpath is empty.
- Insufficient free space exists in CCATEMP.
- For more information about using XPath expressions, see XPath.
- These methods also obtain information about the name of a node: