if (tag.get() != kTreeItemAtom) return NS_OK;
if (tag.get() == kTreeItemAtom) {
RDFGenericBuilderImpl::CloseContainer(nsIContent* aElement){    NS_PRECONDITION(aElement != nsnull, "null ptr");    if (! aElement)        return NS_ERROR_NULL_POINTER;    // First, make sure that the element is in the right widget -- ours.    if (!IsElementInWidget(aElement))        return NS_OK;    nsresult rv;    nsCOMPtr<nsIAtom> tag;    rv = aElement->GetTag(*getter_AddRefs(tag));    if (NS_FAILED(rv)) return rv;    // If it's not a tree, just bail. Keep the content around until    // the cows come home.    if (tag.get() != kTreeItemAtom)        return NS_OK;    // Find the tag that contains the children so that we can remove    // all of the children.    //    // XXX We do this as a (premature?) optimization so that nodes    // which are not being displayed don't hang around taking up    // space. Unfortunately, the tree widget currently _relies_ on    // this behavior and will break if we don't do it :-(.    nsCOMPtr<nsIContent> insertionpoint;    rv = FindInsertionPoint(aElement, getter_AddRefs(insertionpoint));    if (NS_FAILED(rv)) return rv;    if (insertionpoint) {        PRInt32 count;        rv = insertionpoint->ChildCount(count);        if (NS_FAILED(rv)) return rv;        rv = RemoveGeneratedContent(insertionpoint);        if (NS_FAILED(rv)) return rv;    }    // Force the XUL element to remember that it needs to re-generate    // its kids next time around.    nsCOMPtr<nsIXULContent> xulcontent = do_QueryInterface(aElement);    NS_ASSERTION(xulcontent != nsnull, "not an nsIXULContent");    if (! xulcontent)        return NS_ERROR_UNEXPECTED;    rv = xulcontent->SetLazyState(nsIXULContent::eChildrenMustBeRebuilt);	if (NS_FAILED(rv)) return rv;    // Clear the contents-generated attribute so that the next time we    // come back, we'll regenerate the kids we just killed.    rv = xulcontent->ClearLazyState(nsIXULContent::eContainerContentsBuilt);    if (NS_FAILED(rv)) return rv;    return NS_OK;}