if (NS_FAILED(rv = element->GetAttribute(kNameSpaceID_XUL,
if (NS_FAILED(rv = element->GetAttribute(kNameSpaceID_None,
RDFTreeBuilderImpl::OnAssert(nsIRDFResource* aSubject,                             nsIRDFResource* aPredicate,                             nsIRDFNode* aObject){    NS_PRECONDITION(mDocument != nsnull, "not initialized");    if (! mDocument)        return NS_ERROR_NOT_INITIALIZED;    nsresult rv;    nsCOMPtr<nsISupportsArray> elements;    if (NS_FAILED(rv = NS_NewISupportsArray(getter_AddRefs(elements)))) {        NS_ERROR("unable to create new ISupportsArray");        return rv;    }    // Find all the elements in the content model that correspond to    // aSubject: for each, we'll try to build XUL children if    // appropriate.    if (NS_FAILED(rv = mDocument->GetElementsForResource(aSubject, elements))) {        NS_ERROR("unable to retrieve elements from resource");        return rv;    }    for (PRInt32 i = elements->Count() - 1; i >= 0; --i) {        nsCOMPtr<nsIContent> element( do_QueryInterface(elements->ElementAt(i)) );                // XXX somehow figure out if building XUL kids on this        // particular element makes any sense whatsoever.        // We'll start by making sure that the element at least has        // the same parent has the content model builder's root        if (! IsElementInTree(element))            continue;                nsCOMPtr<nsIRDFResource> resource;        if (NS_SUCCEEDED(aObject->QueryInterface(kIRDFResourceIID,                                                 (void**) getter_AddRefs(resource)))            && IsTreeProperty(element, aPredicate)) {            // Okay, the object _is_ a resource, and the predicate is            // a tree property. So this'll be a new row in the tree            // control.            // But if the contents of aElement _haven't_ yet been            // generated, then just ignore the assertion. We do this            // because we know that _eventually_ the contents will be            // generated (via CreateContents()) when somebody asks for            // them later.            nsAutoString contentsGenerated;            if (NS_FAILED(rv = element->GetAttribute(kNameSpaceID_XUL,                                                     kContentsGeneratedAtom,                                                     contentsGenerated))) {                NS_ERROR("severe problem trying to get attribute");                return rv;            }            if ((rv == NS_CONTENT_ATTR_HAS_VALUE) &&                contentsGenerated.EqualsIgnoreCase("true")) {                // Okay, it's a "live" element, so go ahead and append the new                // child to this node.                if (NS_FAILED(rv = AddTreeRow(element, aPredicate, resource))) {                    NS_ERROR("unable to create new tree row");                    return rv;                }            }        }        else {            // Either the object of the assertion is not a resource,            // or the object is a resource and the predicate is not a            // tree property. So this won't be a new row in the            // table. See if we can use it to set a cell value on the            // current element.            if (NS_FAILED(rv = SetCellValue(element, aPredicate, aObject))) {                NS_ERROR("unable to set cell value");                return rv;            }        }    }    return NS_OK;}