LocalName (XmlDoc/XmlNode function): Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Template:XmlDoc/XmlNode:LocalName subtitle}} | |||
[[Category:XmlDoc methods|LocalName function]] | [[Category:XmlDoc methods|LocalName function]] | ||
[[Category:XmlNode methods|LocalName function]] | [[Category:XmlNode methods|LocalName function]] | ||
Line 11: | Line 11: | ||
</p> | </p> | ||
This function gets the | This function gets the "local name" (the name ignoring any | ||
prefix and colon) of the node that is the head of an XPath result. | prefix and colon) of the node that is the head of an XPath result. | ||
==Syntax== | |||
{{Template:XmlDoc/XmlNode:LocalName syntax}} | |||
===Syntax terms=== | |||
<dl> | <dl> | ||
<dt>%name | <dt>%name | ||
Line 31: | Line 31: | ||
</dl> | </dl> | ||
==Usage notes== | |||
<ul> | <ul> | ||
<li>The local name is defined to be: | <li>The local name is defined to be: |
Revision as of 16:57, 22 January 2011
Name (without prefix) of selected node (XmlDoc and XmlNode classes)
LocalName is a member of the XmlDoc and XmlNode classes.
This function gets the "local name" (the name ignoring any prefix and colon) of the node that is the head of an XPath result.
Syntax
%unicode = nr:LocalName[( [xpath])] Throws XPathError
Syntax terms
- %name
- 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. An optional argument, its default is a period (.), that is, the node referenced by the method object (nr).
Usage notes
- 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. For more information about the effects of this version 7.6 change, see Strings and Unicode. For an example of a specific effect that involves the Value method, see item ?? refid=univalx..
Example
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 Object 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:
bar junk
Request-Cancellation Errors
- XmlDoc Namespace property not On
- XPath is invalid.
- Result of (XPath) is empty.
- Insufficient free space exists in CCATEMP.