CBufDescriptor wrapper(value, PR_TRUE, 0, -1);
XULDocumentImpl::ApplyPersistentAttributesToElements(nsIRDFResource* aResource, nsISupportsArray* aElements){    nsresult rv;    nsCOMPtr<nsISimpleEnumerator> attrs;    rv = mLocalStore->ArcLabelsOut(aResource, getter_AddRefs(attrs));    if (NS_FAILED(rv)) return rv;    while (1) {        PRBool hasmore;        rv = attrs->HasMoreElements(&hasmore);        if (NS_FAILED(rv)) return rv;        if (! hasmore)            break;        nsCOMPtr<nsISupports> isupports;        rv = attrs->GetNext(getter_AddRefs(isupports));        if (NS_FAILED(rv)) return rv;        nsCOMPtr<nsIRDFResource> property = do_QueryInterface(isupports);        if (! property) {            NS_WARNING("expected a resource");            continue;        }        const char* attrname;        rv = property->GetValueConst(&attrname);        if (NS_FAILED(rv)) return rv;        nsCOMPtr<nsIAtom> attr = dont_AddRef(NS_NewAtom(attrname));        if (! attr)            return NS_ERROR_OUT_OF_MEMORY;        // XXX could hang namespace off here, as well...        nsCOMPtr<nsIRDFNode> node;        rv = mLocalStore->GetTarget(aResource, property, PR_TRUE, getter_AddRefs(node));        if (NS_FAILED(rv)) return rv;        nsCOMPtr<nsIRDFLiteral> literal = do_QueryInterface(node);        if (! literal) {            NS_WARNING("expected a literal");            continue;        }        const PRUnichar* value;        rv = literal->GetValueConst(&value);        if (NS_FAILED(rv)) return rv;        PRUint32 cnt;        rv = aElements->Count(&cnt);        if (NS_FAILED(rv)) return rv;                    for (PRInt32 i = PRInt32(cnt) - 1; i >= 0; --i) {            nsISupports* isupports2 = aElements->ElementAt(i);            if (! isupports2)                continue;            nsCOMPtr<nsIContent> element = do_QueryInterface(isupports2);            NS_RELEASE(isupports2);            CBufDescriptor wrapper(value, PR_TRUE, 0, -1);            rv = element->SetAttribute(/* XXX */ kNameSpaceID_None,                                       attr,                                       nsAutoString(wrapper),                                       PR_FALSE);        }    }    return NS_OK;}