if (mFlags & eDontTestEmpty) return NS_OK;
nsXULTemplateBuilder::CheckContainer(nsIRDFResource* aResource, PRBool* aIsContainer, PRBool* aIsEmpty){    // We have to look at all of the arcs extending out of the    // resource: if any of them are that "containment" property, then    // we know we'll have children.    nsresult rv;#ifdef RDF_USE_HAS_ARC_OUT    *aIsContainer = PR_FALSE;	*aIsEmpty = PR_TRUE;    for (ResourceSet::ConstIterator property = mContainmentProperties.First();         property != mContainmentProperties.Last();         property++) {        PRBool hasArc;        rv = mDB->HasArcOut(aResource, *property, &hasArc);        if (NS_FAILED(rv)) return rv;        if (hasArc) {            // Well, it's a container...            *aIsContainer = PR_TRUE;            // ...is it empty?            nsCOMPtr<nsIRDFNode> dummy;            rv = mDB->GetTarget(aResource, *property, PR_TRUE, getter_AddRefs(dummy));            if (NS_FAILED(rv)) return rv;            if (dummy != nsnull) {                *aIsEmpty = PR_FALSE;                return NS_OK;            }            // Even if there isn't a target for *this* containment            // property, we have continue to check the other            // properties: one of them may have a target.        }    }    // If we get here, and it's a container, then it's an *empty*    // container.    if  (*aIsContainer)        return NS_OK;    // Otherwise, just return whether or not it's an RDF container    rv = gRDFContainerUtils->IsContainer(mDB, aResource, aIsContainer);    if (NS_FAILED(rv)) return rv;    if (*aIsContainer) {        rv = gRDFContainerUtils->IsEmpty(mDB, aResource, aIsEmpty);        if (NS_FAILED(rv)) return rv;    }    return NS_OK;#else    nsCOMPtr<nsISimpleEnumerator> arcs;    rv = mDB->ArcLabelsOut(aResource, getter_AddRefs(arcs));    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get arcs out");    if (NS_FAILED(rv)) return rv;    // Initialize to some sane default values    *aIsContainer = PR_FALSE;    *aIsEmpty = PR_TRUE;    while (1) {        PRBool hasMore;        rv = arcs->HasMoreElements(&hasMore);        NS_ASSERTION(NS_SUCCEEDED(rv), "severe error advancing cursor");        if (NS_FAILED(rv))            return PR_FALSE;        if (! hasMore)            break;        nsCOMPtr<nsISupports> isupports;        rv = arcs->GetNext(getter_AddRefs(isupports));        if (NS_FAILED(rv))            return PR_FALSE;        nsCOMPtr<nsIRDFResource> property = do_QueryInterface(isupports);        PRBool isordinal;        rv = gRDFContainerUtils->IsOrdinalProperty(property, &isordinal);        if (NS_FAILED(rv)) return rv;        if (isordinal || mContainmentProperties.Contains(property)) {            // Well, it's a container...            *aIsContainer = PR_TRUE;            // ...is it empty?            nsCOMPtr<nsIRDFNode> dummy;            rv = mDB->GetTarget(aResource, property, PR_TRUE, getter_AddRefs(dummy));            if (NS_FAILED(rv)) return rv;            if (dummy != nsnull) {                *aIsEmpty = PR_FALSE;                return NS_OK;            }            // Even if there isn't a target for *this* containment            // property, we have continue to check the other            // properties: one of them may have a target.        }    }    // If we get here, and it's a container, then it's an *empty*    // container.    if  (*aIsContainer)        return NS_OK;    // Otherwise, just return whether or not it's an RDF container    return gRDFContainerUtils->IsContainer(mDB, aResource, aIsContainer);#endif}