NextNode - cXMLDOMAttribute

Returns the object's next sibling node and destroys the current node

Type: Function

Return Data Type: Handle

Parameters: None

Return Value

Returns the object's next sibling node and destroys the current node. If no next sibling exists, zero is returned.


Syntax
Function NextNode Returns Handle

Call: Get NextNode to HandleVariable


Description

NextNode is used to find the node's next sibling Xml object. It also destroys itsself. This makes it very easy to traverse a list of nodes without needing to destroy each node manually. It is often used with FirstChild.

Get FirstChild of hoRoot to hoNode // get the first node
While (hoNode<>0)
    Send ShowInformation hoNode
    Get NextNode of hoNode to hoNode // now get next sibling node
Loop

This is similar to the NextSibling method, which finds the next sibling but does not destroy the existing node. The following example is the same as the sample. In most cases, you will find it easier to use NextNode.

Get FirstChild of hoRoot to hoNode // get the first node
While (hoNode<>0)
    Send ShowInformation hoNode
    Get NextSibling of hoNode to hoNextNode // now get next sibling node
    Send Destroy of hoNode     // Important: get rid of the previous node object
    Move hoNextNode to hoNode
Loop

See Also

FirstChild | NextSibling