Length (XmlDoc/XmlNode function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
Line 1: | Line 1: | ||
{{Template:XmlDoc/XmlNode:Length subtitle}} | {{Template:XmlDoc/XmlNode:Length subtitle}} | ||
The Length function gets the length of the string-value of a node, which includes | The <var>Length</var> function gets the length of the string-value of a node, which includes | ||
its Text descendants. | its Text descendants. | ||
==Syntax== | ==Syntax== | ||
Line 8: | Line 8: | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%len</th> | <tr><th>%len</th> | ||
<td>A numeric variable to contain the returned value from Length. </td></tr> | <td>A numeric variable to contain the returned value from <var>Length</var>. </td></tr> | ||
<tr><th>nr</th> | <tr><th>nr</th> | ||
<td>An XmlDoc or XmlNode, used as the context node for the <i>XPath</i> expression. If an XmlDoc, the Root node is the context node. </td></tr> | <td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <i>XPath</i> expression. If an <var>XmlDoc</var>, the Root node is the context node. </td></tr> | ||
<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 <var>Unicode</var> 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>). | ||
<p class="code">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> | </p> | ||
Line 21: | Line 21: | ||
the value "13": | the value "13": | ||
<p class="code">Begin | <p class="code">Begin | ||
%d Object XmlDoc | %d <var>Object</var> <var>XmlDoc</var> | ||
%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:<var>Length</var>('/t') | ||
End | End | ||
</p> | </p> |
Revision as of 17:46, 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.