code: public int getNextSibling(int nodeHandle) {
                  nodeHandle &= NODEHANDLE_MASK;
                  // Document root has no next sibling
                  if (nodeHandle == 0)
                          return NULL;
  
                  short type = (short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF);
                  if ((type == ELEMENT_NODE) || (type == ATTRIBUTE_NODE) ||
                                  (type == ENTITY_REFERENCE_NODE)) {
                          int nextSib = nodes.readEntry(nodeHandle, 2);
                          if (nextSib == NULL)
                                  return NULL;
                          if (nextSib != 0)
                                  return (m_docHandle | nextSib);
                          // ###shs should cycle/wait if nextSib is 0? Working on threading next
                  }
                  // Next Sibling is in the next position if it shares the same parent
                  int thisParent = nodes.readEntry(nodeHandle, 1);
  
                  if (nodes.readEntry(++nodeHandle, 1) == thisParent)
                          return (m_docHandle | nodeHandle);
  
                  return NULL;
          }
docs: Given a node handle, advance to its next sibling.
  
  %TBD% This currently uses the DTM-internal definition of
  sibling; eg, the last attr's next sib is the first
  child. In the old DTM, the DOM proxy layer provided the
  additional logic for the public view.  If we're rewriting
  for XPath emulation, that test must be done here.
  
  %TBD% CODE INTERACTION WITH INCREMENTAL PARSE - If not yet
  resolved, should wait for more nodes to be added to the document
  and tries again.
  
  @param nodeHandle int Handle of the node.
  @return int Node-number of next sibling,
  or DTM.NULL to indicate none exists.