nsIContent *content; nsresult res = NS_OK;  if (nsnull != mContent) { mContent->ChildAt(aIndex, content); if (nsnull != content) { res = content->QueryInterface(kIDOMNodeIID, (void**)aReturn); NS_RELEASE(content);
nsresult res = NS_ERROR_FAILURE; nsAutoString name, value; nsISupportsArray *attributes = nsnull; if (NS_OK == NS_NewISupportsArray(&attributes)) { PRInt32 count; mContent->GetAllAttributeNames(attributes, count); if (count > 0) { if ((PRInt32)aIndex < count) { nsISupports *att = attributes->ElementAt(aIndex); static NS_DEFINE_IID(kIAtom, NS_IATOM_IID); nsIAtom *atName = nsnull; if (nsnull != att && NS_OK == att->QueryInterface(kIAtom, (void**)&atName)) { atName->ToString(name); if (NS_CONTENT_ATTR_NOT_THERE != mContent->GetAttribute(name, value)) { *aReturn = (nsIDOMNode *)new DOMAttribute(name, value); res = NS_OK; } NS_RELEASE(atName); } }
nsChildContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn){  nsIContent *content;  nsresult res = NS_OK;    if (nsnull != mContent) {    mContent->ChildAt(aIndex, content);    if (nsnull != content) {      res = content->QueryInterface(kIDOMNodeIID, (void**)aReturn);      NS_RELEASE(content);    }    else {      *aReturn = nsnull;    }  }  else {    *aReturn = nsnull;  }  return res;}