if (! contentsGenerated.EqualsIgnoreCase("true"))
if (! contentsGenerated.Equals("true"))
RDFXULBuilderImpl::OnUnassert(nsIRDFResource* aSource,                              nsIRDFResource* aProperty,                              nsIRDFNode* aTarget){    NS_PRECONDITION(mDocument != nsnull, "not initialized");    if (! mDocument)        return NS_ERROR_NOT_INITIALIZED;    if (mPermitted && mPermitted != aTarget)        return NS_OK;    // Stuff that we can ignore outright    // XXX is this the best place to put it???    if (aProperty == kRDF_nextVal)        return NS_OK;    nsresult rv;#ifdef PR_LOGGING    if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {        nsXPIDLCString source;        aSource->GetValue(getter_Copies(source));        nsXPIDLCString property;        aProperty->GetValue(getter_Copies(property));        nsAutoString targetStr;        nsRDFContentUtils::GetTextForNode(aTarget, targetStr);        char* targetCStr = targetStr.ToNewCString();        PR_LOG(gLog, PR_LOG_DEBUG, ("xulbuilder on-unassert"));        PR_LOG(gLog, PR_LOG_DEBUG, ("    (%s)",    (const char*) source));        PR_LOG(gLog, PR_LOG_DEBUG, ("  --[%s]-->", (const char*) property));        PR_LOG(gLog, PR_LOG_DEBUG, ("    (%s)",    targetCStr));        nsCRT::free(targetCStr);    }#endif    nsCOMPtr<nsISupportsArray> elements;    rv = NS_NewISupportsArray(getter_AddRefs(elements));    if (NS_FAILED(rv)) return rv;    // Find all the elements in the content model that correspond to    // aSource: for each, we'll try to remove XUL children if    // appropriate.    rv = mDocument->GetElementsForResource(aSource, elements);    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to retrieve elements from resource");    if (NS_FAILED(rv)) return rv;    PRUint32 cnt = 0;    rv = elements->Count(&cnt);    NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");    for (PRInt32 i = cnt - 1; i >= 0; --i) {        nsISupports* isupports = elements->ElementAt(i);        nsCOMPtr<nsIContent> element( do_QueryInterface(isupports) );        NS_IF_RELEASE(isupports);                // XXX somehow figure out if removing XUL kids from this        // particular element makes any sense whatsoever.        PRBool isOrdinal;        rv = gRDFContainerUtils->IsOrdinalProperty(aProperty, &isOrdinal);        if (NS_FAILED(rv)) return rv;        if (isOrdinal) {            // It's a child node. If the contents of aElement _haven't_            // yet been generated, then just ignore the unassertion. We do            // this because we know that _eventually_ the contents will be            // generated (via CreateContents()) when somebody asks for            // them later.            nsAutoString contentsGenerated;            rv = element->GetAttribute(kNameSpaceID_None,                                       kXULContentsGeneratedAtom,                                       contentsGenerated);            if (NS_FAILED(rv)) return rv;            if (rv == NS_CONTENT_ATTR_NOT_THERE || rv == NS_CONTENT_ATTR_NO_VALUE)                continue;            if (! contentsGenerated.EqualsIgnoreCase("true"))                continue;            // Okay, it's a "live" element, so go ahead and remove the            // child from this node.            rv = RemoveChild(element, aTarget);            NS_ASSERTION(NS_SUCCEEDED(rv), "problem removing child from content model");            if (NS_FAILED(rv)) return rv;        }        else if (aProperty == kXUL_tag) {            // We shouldn't ever see this: if we do, there ain't much we            // can do.            PR_LOG(gLog, PR_LOG_ALWAYS,                   ("xulbuilder on-unassert: attempt to remove tag type ignored"));        }        else {            // Remove this attribute from the element.            rv = RemoveAttribute(element, aProperty, aTarget);            NS_ASSERTION(NS_SUCCEEDED(rv), "unable to remove attribute to the element");            if (NS_FAILED(rv)) return rv;        }    }    return NS_OK;}