Length (XmlDoc/XmlNode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 11: Line 11:
<td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <var>XPath</var> expression. If an <var>XmlDoc</var>, the <var>Root</var> node is the context node.</td></tr>
<td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <var>XPath</var> 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 <var>nodelist</var>. The head of the <var>nodelist</var> is the node to process. An optional argument, its default is a period (.), 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.</td></tr>
<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. An optional argument, 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.</td></tr>
</table>
</table>


==Examples==
==Examples==
<ol><li>The following example displays the value "<code>13</code>":
The following example displays the value <code>13</code>:
<p class="code">begin
<p class="code">begin
   %d object xmlDoc
   %d object xmlDoc
Line 22: Line 22:
   print %d:length('/t')
   print %d:length('/t')
end
end
</p></ol>
</p>
 
==Request-Cancellation Errors==
==Request-Cancellation Errors==
<ul>
<ul>
<li><var class="term">XPath</var> is invalid.
<li><var class="term">xpath</var> is invalid.
<li>Result of (<var class="term">XPath</var>) is empty.
<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 34: Line 33:
<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>For more information about using <var>XPath</var> expressions, see [[XPath]].
<li>For more information about using <var>XPath</var> expressions, see [[XPath|"XPath"]].
</ul>
</ul>
{{Template:XmlDoc/XmlNode:Length footer}}
{{Template:XmlDoc/XmlNode:Length footer}}

Revision as of 23:32, 24 May 2011

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 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.

Examples

The following example displays the value 13:

begin %d object xmlDoc %d:loadXml('<t><a>Hell</a>' with - '<b>o, world!'</b></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".