FirstChild - cXMLDOMAttribute

Finds the first child of a node and returns a handle to it

Type: Function

Return Data Type: Handle

Parameters: None

Return Value

Returns an object handle to the first child, zero if none


Syntax
Function FirstChild Returns Handle

Call: Get FirstChild to HandleVariable


Description

FirstChild finds the first child of a node and returns a handle to it. The message is sent to the parent node. It is often used with NextNode to traverse all child nodes.

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

The NextSibling message can also be used to find the next sibling node (and not destroy the current node). NextNode is usually preferred.

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

NextNode | NextSibling | PreviousSibling | LastChild