Count (XmlNodelist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Created page with "<span style="font-size:120%; color:black"><b>Number of nodes in XmlNodelist</b></span> Count function Count function [[Ca...")
 
mNo edit summary
Line 1: Line 1:
<span style="font-size:120%; color:black"><b>Number of nodes in XmlNodelist</b></span>
<span style="font-size:120%; color:black"><b>Number of nodes in XmlNodelist</b></span>
[[Category:XmlDoc methods|Count function]]
[[Category:XmlNodelist methods|Count function]]
[[Category:XmlNode methods|Count function]]
[[Category:XmlDoc API methods]]
[[Category:XmlDoc API methods]]
<!--DPL?? Category:XmlDoc methods|Count function: Number of nodes in XmlNodelist-->
<!--DPL?? Category:XmlNodelist methods|Count function: Number of nodes in XmlNodelist-->
<!--DPL?? Category:XmlNode methods|Count function: Number of nodes in XmlNodelist-->
<!--DPL?? Category:XmlDoc API methods|Count (XmlNodelist function): Number of nodes in XmlNodelist-->
<!--DPL?? Category:XmlDoc API methods|Count (XmlDoc/XmlNode function): Number of nodes in XmlNodelist-->
<!--DPL?? Category:System methods|Count (XmlNodelist function): Number of nodes in XmlNodelist-->
<!--DPL?? Category:System methods|Count (XmlDoc/XmlNode function): Number of nodes in XmlNodelist-->
<p>
<p>
Count is a member of the [[XmlDoc class|XmlDoc]] and [[XmlNode class|XmlNode]] classes.
Count is a member of the [[XmlNodelist class]].
</p>
</p>
This method gets the number of nodes in an XmlNodelist.
===Syntax===
===Syntax===
   %count = nlis:Count
   %count = nlis:Count

Revision as of 21:08, 4 January 2011

Number of nodes in XmlNodelist

Count is a member of the XmlNodelist class.

Syntax

  %count = nlis:Count

Syntax Terms

%count
A numeric variable for the number of nodes on XmlNodelist nlis.
nlis
An XmlNodelist expression, specifying the nodelist to count.

Example

In the following example, the Count method is used to limit a For loop which selectively adds nodes to the document:

    Begin
    %doc is Object XmlDoc
    %doc = New
    %doc:LoadXml('<top> <a>a1</a> <a>a2</a> <a>a3</a> </top>')
    %nl1 is Object XmlNodelist
    %n1 is Object XmlNode
    %n2 is Object XmlNode
    %j is Float
    %nl1 = %doc:SelectNodes('/top/a')
    For %j from 1 to %nl1:Count
       %n1 = %nl1:Item(%j)
       %n2 = %n1:AddElement('b', 'b' With %j)
    End For
    Call %d1:Print
    End

The example results follow:

    <top>
       <a>
          a1
          <b>b1</b>
       </a>
       <a>
          a2
          <b>b2</b>
       </a>
       <a>
          a3
          <b>b3</b>
       </a>
    </top>

Request-Cancellation Errors

  • Count has no request cancellation errors.


See Also

  • SelectCount counts the number of nodes in an XPath expression result.