public int getFirstChild(int nodeHandle) {

                // ###shs worry about tracing/debug later
                nodeHandle &= NODEHANDLE_MASK;
                // Read node into variable
                nodes.readSlot(nodeHandle, gotslot);

                // type is the last half of first slot
                short type = (short) (gotslot[0] & 0xFFFF);

                // Check to see if Element or Document node
                if ((type == ELEMENT_NODE) || (type == DOCUMENT_NODE) ||
                                (type == ENTITY_REFERENCE_NODE)) {

                        // In case when Document root is given
                        //	if (nodeHandle == 0) nodeHandle = 1;
                        // %TBD% Probably was a mistake.
                        // If someone explicitly asks for first child
                        // of Document, I would expect them to want
                        // that and only that.

                        int kid = nodeHandle + 1;
                        nodes.readSlot(kid, gotslot);
                        while (ATTRIBUTE_NODE == (gotslot[0] & 0xFFFF)) {
                                // points to next sibling
                                kid = gotslot[2];
                                // Return NULL if node has only attributes
                                if (kid == NULL) return NULL;
                                nodes.readSlot(kid, gotslot);
                        }
                        // If parent slot matches given parent, return kid
                        if (gotslot[1] == nodeHandle)
                        {
                          int firstChild = kid | m_docHandle;

                          return firstChild;
                        }
                }
                // No child found

                return NULL;
        }
public int getFirstChild ( int nodeHandle ) { nodeHandle &= NODEHANDLE_MASK ; nodes . readSlot ( nodeHandle , gotslot ) ; short type = ( short ) ( gotslot [ 0 ] & 0xFFFF ) ; if ( ( type == ELEMENT_NODE ) || ( type == DOCUMENT_NODE ) || ( type == ENTITY_REFERENCE_NODE ) ) { int kid = nodeHandle + 1 ; nodes . readSlot ( kid , gotslot ) ; while ( ATTRIBUTE_NODE == ( gotslot [ 0 ] & 0xFFFF ) ) { kid = gotslot [ 2 ] ; if ( kid == NULL ) return NULL ; nodes . readSlot ( kid , gotslot ) ; } if ( gotslot [ 1 ] == nodeHandle ) { int firstChild = kid | m_docHandle ; return firstChild ; } } return NULL ; }
Given a node handle, get the handle of the node's first child.
If not yet resolved, waits for more nodes to be added to the document and
tries again.

@param nodeHandle int Handle of the node.
@return int DTM node-number of first child, or DTM.NULL to indicate none exists.