Length (XmlDoc/XmlNode function): Difference between revisions
Jump to navigation
Jump to search
m (xpath expression) |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
{{Template:XmlDoc/XmlNode:Length syntax}} | {{Template:XmlDoc/XmlNode:Length syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%number</th> | <tr><th nowrap>%number</th> | ||
<td>A numeric variable to contain the returned value from <var>Length</var>.</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 <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <var> | <td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <var class="term">xpath</var> argument expression. If an <var>XmlDoc</var>, the <var>Root</var> node is the context node.</td></tr> | ||
<tr><th>xpath</th> | <tr><th>xpath</th> | ||
<td>A <var>Unicode</var> string that is an [[XPath#XPath_syntax|XPath expression]] that results in a | <td>A <var>Unicode</var> string that is an [[XPath#XPath_syntax|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. | ||
<p> | |||
This is an optional argument, and its default is a period (<tt>.</tt>), that is, the node referenced by the method object (<var class="term">nr</var>). Prior to <var class="product">[[Sirius Mods|Sirius Mods]]</var> Version 7.6, this is an EBCDIC string.</p></td></tr> | |||
</table> | </table> | ||
==Examples== | ==Examples== | ||
The following example displays the value <code>13</code>: | |||
<p class="code">begin | <p class="code">begin | ||
%d object xmlDoc | %d object xmlDoc | ||
%d = new | |||
%d:[[LoadXml_(XmlDoc/XmlNode_function)|loadXml]]<nowiki>('<t><a>Hell</a>' with - | %d:[[LoadXml_(XmlDoc/XmlNode_function)|loadXml]]<nowiki>('<t><a>Hell</a>' with - | ||
'<b>o, world! | '<b>o, world!</b></t>')</nowiki> | ||
print %d:length('/t') | print %d:length('/t') | ||
end | end | ||
</p | </p> | ||
==Request- | ==Request-cancellation errors== | ||
This list is not exhaustive: it does <i>not</i> include all the errors that are request cancelling. | |||
<ul> | <ul> | ||
<li><var class="term"> | <li>The <var class="term">xpath</var> expression is invalid. | ||
<li>Result of | <li>Result of <var class="term">xpath</var> is empty. | ||
<li>Insufficient free space exists in CCATEMP. | <li>Insufficient free space exists in CCATEMP. | ||
</ul> | </ul> | ||
Line 33: | Line 40: | ||
==See also== | ==See also== | ||
<ul> | <ul> | ||
<li><var>[[Value (XmlDoc/XmlNode property)|Value]]</var> discusses the '''string-value''' of various node types. | <li><var>[[Value (XmlDoc/XmlNode property)|Value]]</var> discusses the '''string-value''' of various node types.</li> | ||
<li>For more information about using | |||
<li>For more information about using XPath expressions, see [[XPath]].</li> | |||
</ul> | </ul> | ||
{{Template:XmlDoc/XmlNode:Length footer}} | {{Template:XmlDoc/XmlNode:Length footer}} |
Latest revision as of 21:25, 2 September 2015
Length of string-value of selected node (XmlDoc and XmlNode classes)
Length returns the length of the string-value of a node including its Text descendants.
Syntax
%number = nr:Length[( [xpath])] Throws XPathError
Syntax terms
%number | A numeric variable to contain the returned value from Length. |
---|---|
nr | An XmlDoc or XmlNode, used as the context node for the xpath argument 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). Prior to Sirius Mods Version 7.6, this is an EBCDIC string. |
Examples
The following example displays the value 13
:
begin %d object xmlDoc %d = new %d:loadXml('<t><a>Hell</a>' with - '<b>o, world!</b></t>') print %d:length('/t') end
Request-cancellation errors
This list is not exhaustive: it does not include all the errors that are request cancelling.
- The xpath expression 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.