nsresult rv = NS_CONTENT_ATTR_NOT_THERE;  if (nsnull != mAttributes) { PRInt32 count = mAttributes->Count(); PRInt32 index; for (index = 0; index < count; index++) { const nsGenericAttribute* attr = (const nsGenericAttribute*)mAttributes->ElementAt(index); if ((aNameSpaceID == kNameSpaceID_Unknown || attr->mNodeInfo->NamespaceEquals(aNameSpaceID)) && (attr->mNodeInfo->Equals(aName))) { attr->mNodeInfo->GetPrefixAtom(aPrefix); aResult.Assign(attr->mValue); if (0 < aResult.Length()) { rv = NS_CONTENT_ATTR_HAS_VALUE; } else { rv = NS_CONTENT_ATTR_NO_VALUE; } break; } } }  if (rv == NS_CONTENT_ATTR_NOT_THERE) {     aResult.Truncate(); }  return rv; }
nsGenericContainerElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,                                        nsIAtom*& aPrefix,                                        nsAWritableString& aResult) const{  NS_ASSERTION(nsnull != aName, "must have attribute name");  if (nsnull == aName) {    return NS_ERROR_NULL_POINTER;  }  nsresult rv = NS_CONTENT_ATTR_NOT_THERE;  if (nsnull != mAttributes) {    PRInt32 count = mAttributes->Count();    PRInt32 index;    for (index = 0; index < count; index++) {      const nsGenericAttribute* attr = (const nsGenericAttribute*)mAttributes->ElementAt(index);      if ((aNameSpaceID == kNameSpaceID_Unknown ||           attr->mNodeInfo->NamespaceEquals(aNameSpaceID)) &&          (attr->mNodeInfo->Equals(aName))) {        attr->mNodeInfo->GetPrefixAtom(aPrefix);        aResult.Assign(attr->mValue);        if (0 < aResult.Length()) {          rv = NS_CONTENT_ATTR_HAS_VALUE;        }        else {          rv = NS_CONTENT_ATTR_NO_VALUE;        }        break;      }    }  }  if (rv == NS_CONTENT_ATTR_NOT_THERE) {    // In other cases we already set the out param.    // Since we are returning a success code we'd better do    // something about the out parameters (someone may have    // given us a non-empty string).    aResult.Truncate();  }  return rv;}