nsresult		rv; nsCOMPtr <nsIRDFResource>	resource; nsCOMPtr <nsIRDFLiteral>	literal; nsCOMPtr <nsIRDFDate>	dateLiteral; nsCOMPtr <nsIRDFInt>	intLiteral;
nsXULContentUtils::GetTextForNode(nsIRDFNode* aNode, nsString& aResult){    nsresult		rv;    nsCOMPtr <nsIRDFResource>	resource;    nsCOMPtr <nsIRDFLiteral>	literal;    nsCOMPtr <nsIRDFDate>	dateLiteral;    nsCOMPtr <nsIRDFInt>	intLiteral;    if (! aNode) {        aResult.Truncate();        rv = NS_OK;    }    else if (NS_SUCCEEDED(rv = aNode->QueryInterface(kIRDFResourceIID, getter_AddRefs(resource)))) {        nsXPIDLCString p;        if (NS_SUCCEEDED(rv = resource->GetValue( getter_Copies(p) ))) {            aResult = p;        }    }    else if (NS_SUCCEEDED(rv = aNode->QueryInterface(kIRDFDateIID, getter_AddRefs(dateLiteral)))) {	PRInt64		theDate;        if (NS_SUCCEEDED(rv = dateLiteral->GetValue( &theDate ))) {		// XXX can we cache this somehow instead of creating/destroying it all the time?		nsCOMPtr <nsIDateTimeFormat> aDateTimeFormat;		rv = nsComponentManager::CreateInstance(kDateTimeFormatCID, NULL,			      nsIDateTimeFormat::GetIID(), getter_AddRefs(aDateTimeFormat));		if (NS_SUCCEEDED(rv) && aDateTimeFormat)		{			rv = aDateTimeFormat->FormatPRTime(nsnull /* nsILocale* locale */, kDateFormatShort, kTimeFormatSeconds, (PRTime)theDate, aResult);			if (NS_FAILED(rv)) {				aResult.Truncate();			}		}        }    }    else if (NS_SUCCEEDED(rv = aNode->QueryInterface(kIRDFIntIID, getter_AddRefs(intLiteral)))) {	PRInt32		theInt;	aResult.Truncate();        if (NS_SUCCEEDED(rv = intLiteral->GetValue( &theInt ))) {        	aResult.Append(theInt, 10);        }    }    else if (NS_SUCCEEDED(rv = aNode->QueryInterface(kIRDFLiteralIID, getter_AddRefs(literal)))) {        nsXPIDLString p;        if (NS_SUCCEEDED(rv = literal->GetValue( getter_Copies(p) ))) {            aResult = p;        }    }    else {        NS_ERROR("not a resource or a literal");        rv = NS_ERROR_UNEXPECTED;    }    return rv;}