static nsresult GetChild(nsIDOMNode *aParent, PRInt32 aChildNum, nsIDOMNode **aChild)
GetChild(nsIDOMNode *aParent, PRInt32 aChildNum, nsIDOMNode **aChild)
static nsresult GetChild(nsIDOMNode *aParent, PRInt32 aChildNum, nsIDOMNode **aChild){  NS_ENSURE_ARG_POINTER(aParent);  NS_ENSURE_ARG_POINTER(aChild);  *aChild = nsnull;  nsCOMPtr<nsIDOMNodeList> list;  aParent->GetChildNodes(getter_AddRefs(list));  if (!list)    return NS_OK;    PRUint32 count;  list->GetLength(&count);  PRUint32 i;  PRInt32 curChildNum = 0;  for (i = 0; i < count; i++) {    nsCOMPtr<nsIDOMNode> node;    list->Item(i, getter_AddRefs(node));    if (!node)      break;    PRUint16 nodeType;    node->GetNodeType(&nodeType);    if (nodeType == nsIDOMNode::ELEMENT_NODE) {      curChildNum++;    }    if (curChildNum == aChildNum) {      *aChild = node;      NS_ADDREF(*aChild);      break;    }  }  return NS_OK;}