cN->GetParent(*getter_AddRefs(cParent));  if (!cParent) return NS_ERROR_FAILURE;   PRInt32 indx; cParent->IndexOf(cN,indx); indx++; cParent->ChildAt(indx,*getter_AddRefs(cSibling)); if (!cSibling)
nsCOMPtr<nsIContent> parent; PRInt32              indx;   if (!NS_SUCCEEDED(cN->GetParent(*getter_AddRefs(parent)))) return NS_ERROR_FAILURE; if (!NS_SUCCEEDED(parent->IndexOf(cN, indx))) return NS_ERROR_FAILURE; if (NS_SUCCEEDED(parent->ChildAt(++indx,*getter_AddRefs(cSibling))) && cSibling)
nsresult nsContentIterator::NextNode(nsCOMPtr<nsIContent> *ioNextNode){  if (!ioNextNode)    return NS_ERROR_NULL_POINTER;      nsCOMPtr<nsIContent> cN = *ioNextNode;  nsCOMPtr<nsIContent> cParent;  nsCOMPtr<nsIContent> cSibling;    cN->GetParent(*getter_AddRefs(cParent));  // no parent? then no next node!  if (!cParent)     return NS_ERROR_FAILURE;     // get next sibling  PRInt32 indx;  cParent->IndexOf(cN,indx);  indx++;  cParent->ChildAt(indx,*getter_AddRefs(cSibling));  if (!cSibling)  {    // curent node has no next sibling, so parent is next node    *ioNextNode = cParent;    return NS_OK;  }    // else next node is siblings "deep left"  child  *ioNextNode = GetDeepFirstChild(cSibling);   return NS_OK;}