nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsAString& aResult)
nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsAWritableString& aResult)
nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsAString& aResult){    if (! aNode) {        aResult.Truncate();        return NS_OK;    }    nsresult rv;    // Literals are the most common, so try these first.    nsCOMPtr<nsIRDFLiteral> literal = do_QueryInterface(aNode);    if (literal) {        const PRUnichar* p;        rv = literal->GetValueConst(&p);        if (NS_FAILED(rv)) return rv;        aResult = p;        return NS_OK;    }    nsCOMPtr<nsIRDFDate> dateLiteral = do_QueryInterface(aNode);    if (dateLiteral) {        PRInt64	value;        rv = dateLiteral->GetValue(&value);        if (NS_FAILED(rv)) return rv;        nsAutoString str;        rv = gFormat->FormatPRTime(nsnull /* nsILocale* locale */,                                  kDateFormatShort,                                  kTimeFormatSeconds,                                  PRTime(value),                                  str);        aResult.Assign(str);        if (NS_FAILED(rv)) return rv;        return NS_OK;    }    nsCOMPtr<nsIRDFInt> intLiteral = do_QueryInterface(aNode);    if (intLiteral) {        PRInt32	value;        rv = intLiteral->GetValue(&value);        if (NS_FAILED(rv)) return rv;        aResult.Truncate();        nsAutoString intStr;        intStr.AppendInt(value, 10);        aResult.Append(intStr);        return NS_OK;    }    nsCOMPtr<nsIRDFResource> resource = do_QueryInterface(aNode);    if (resource) {        const char* p;        rv = resource->GetValueConst(&p);        if (NS_FAILED(rv)) return rv;        CopyASCIItoUTF16(p, aResult);        return NS_OK;    }    NS_ERROR("not a resource or a literal");    return NS_ERROR_UNEXPECTED;}