if (NS_OK == child->GetAttribute(kNameSpaceID_None, kSortDirectionAtom, sortDirection))
if (NS_SUCCEEDED(rv = child->GetAttribute(kNameSpaceID_None, kSortDirectionAtom, sortDirection)) && (rv == NS_CONTENT_ATTR_HAS_VALUE))
XULSortServiceImpl::GetSortColumnInfo(nsIContent *tree, nsString &sortResource, nsString &sortDirection){        nsCOMPtr<nsIContent>	child;	PRBool			found = PR_FALSE;	PRInt32			childIndex, numChildren, nameSpaceID;	nsresult		rv;	if (NS_FAILED(rv = tree->ChildCount(numChildren)))	return(rv);	for (childIndex=0; childIndex<numChildren; childIndex++)	{		if (NS_FAILED(rv = tree->ChildAt(childIndex, *getter_AddRefs(child))))	return(rv);		if (NS_FAILED(rv = child->GetNameSpaceID(nameSpaceID)))	return(rv);		if (nameSpaceID == kNameSpaceID_XUL)		{			nsCOMPtr<nsIAtom> tag;			if (NS_FAILED(rv = child->GetTag(*getter_AddRefs(tag))))				return rv;			if (tag.get() == kTreeColAtom)			{				nsString	value;				if (NS_OK == child->GetAttribute(kNameSpaceID_None, kSortAtom, value))				{					if (value.EqualsIgnoreCase("true"))					{						if (NS_OK == child->GetAttribute(kNameSpaceID_RDF, kResourceAtom, sortResource))						{							if (NS_OK == child->GetAttribute(kNameSpaceID_None, kSortDirectionAtom, sortDirection))							{								found = PR_TRUE;							}						}						break;					}				}			}		}	}	return((found == PR_TRUE) ? NS_OK : NS_ERROR_FAILURE);}