Length (XmlDoc/XmlNode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 20: Line 20:
<tr><th>XPath</th>
<tr><th>XPath</th>
<td>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 (<i>nr</i>).
<td>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 (<i>nr</i>).
Prior to ''Sirius Mods'' version 7.6, this is an EBCDIC string.</td></tr>
<p class="code">Prior to ''Sirius Mods'' version 7.6, this is an EBCDIC string.</td></tr>
</p>
</table>
</table>
===Example===
===Example===
Line 26: Line 27:
The following example displays
The following example displays
the value "13":
the value "13":
<pre>
<p class="code">Begin
    Begin
%d Object XmlDoc
    %d Object XmlDoc
%d:LoadXml('<t><a>Hell</a>' With -
    %d:LoadXml('<t><a>Hell</a>' With -
  '<b>o, world!'</b></t>')
      '<b>o, world!'</b></t>')
Print %d:Length('/t')
    Print %d:Length('/t')
End
    End
</p>
</pre>


===Request-Cancellation Errors===
===Request-Cancellation Errors===

Revision as of 05:42, 25 January 2011

Length of string-value of selected node (XmlDoc and XmlNode classes)

The Length function gets the length of the string-value of a node, which includes its Text descendants.

Syntax

%number = nr:Length[( [xpath])] Throws XPathError

Syntax terms

%len A numeric variable to contain the returned value from Length.
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).

Prior to Sirius Mods version 7.6, this is an EBCDIC string.

Example

The following example displays the value "13":

Begin %d Object XmlDoc %d:LoadXml('<t><a>Hell</a>' With - 'o, world!'</t>') Print %d:Length('/t') End

Request-Cancellation Errors

  • XPath is invalid.
  • Result of (XPath) is empty.
  • Insufficient free space exists in CCATEMP.


See also

  • Value discusses the string-value of various node types.
  • For more information about using XPath expressions, see XPath.