return rv;
nsresult rv;   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	tm; rv = dateLiteral->GetValue(&tm); if (NS_FAILED(rv)) return rv;  rv = gFormat->FormatPRTime(nsnull , kDateFormatShort, kTimeFormatSeconds, PRTime(tm), aResult);  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(); aResult.Append(value, 10); return NS_OK; }   nsCOMPtr<nsIRDFResource> resource = do_QueryInterface(aNode); if (resource) { const char* p; rv = resource->GetValueConst(&p); if (NS_FAILED(rv)) return rv; aResult = p; return NS_OK; }  NS_ERROR("not a resource or a literal"); return NS_ERROR_UNEXPECTED;
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;}