index++;
theIndex++;
TableRowsCollection::GetLength(PRUint32* aLength){  if (nsnull==aLength)    return NS_ERROR_NULL_POINTER;  *aLength=0;  nsresult rv = NS_OK;  if (nsnull!=mParent)  {    // count the rows in the thead, tfoot, and all tbodies    nsIDOMHTMLTableSectionElement *rowGroup;    mParent->GetTHead(&rowGroup);    if (nsnull!=rowGroup)    {      nsIContent *content=nsnull;      rowGroup->QueryInterface(kIContentIID, (void **)&content);      GenericElementCollection head(content, nsHTMLAtoms::tr);      PRUint32 rows;      head.GetLength(&rows);      *aLength = rows;      NS_RELEASE(content);      NS_RELEASE(rowGroup);    }    mParent->GetTFoot(&rowGroup);    if (nsnull!=rowGroup)    {      nsIContent *content=nsnull;      rowGroup->QueryInterface(kIContentIID, (void **)&content);      GenericElementCollection foot(content, nsHTMLAtoms::tr);      PRUint32 rows;      foot.GetLength(&rows);      *aLength += rows;      NS_RELEASE(content);      NS_RELEASE(rowGroup);    }    nsIDOMHTMLCollection *tbodies;    mParent->GetTBodies(&tbodies);    if (nsnull!=tbodies)    {      rowGroup = nsnull;      nsIDOMNode *node;      PRUint32 index=0;      tbodies->Item(index, &node);      while (nsnull!=node)      {        nsIContent *content=nsnull;        node->QueryInterface(kIContentIID, (void **)&content);        GenericElementCollection body(content, nsHTMLAtoms::tr);        PRUint32 rows;        body.GetLength(&rows);        *aLength += rows;        index++;        NS_RELEASE(content);        NS_RELEASE(node);        tbodies->Item(index, &node);      }      NS_RELEASE(tbodies);    }  }  return rv;}