rv = mRDFTests.Clear(); if (NS_FAILED(rv)) return rv;
if (flags.Find(NS_LITERAL_STRING("dont-test-empty")) >= 0) mFlags |= eDontTestEmpty;
nsXULTemplateBuilder::InitializeRuleNetwork(InnerNode** aChildNode){    // The rule network will start off looking something like this:    //    //   (root)-->(content ^id ?a)-->(?a ^member ?b)    //    nsresult rv;    rv = mRules.Clear();    if (NS_FAILED(rv)) return rv;    rv = mRDFTests.Clear();    if (NS_FAILED(rv)) return rv;    rv = ComputeContainmentProperties();    if (NS_FAILED(rv)) return rv;    // Create (content ?content ^id ?container)    mRules.CreateVariable(&mContentVar);    mRules.CreateVariable(&mContainerVar);    mRules.CreateVariable(&mMemberVar);    nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(mDocument);    if (! xuldoc)        return NS_ERROR_UNEXPECTED;    ContentIdTestNode* idnode =        new ContentIdTestNode(mRules.GetRoot(),                              mConflictSet,                              xuldoc,                              mRoot,                              mContentVar,                              mContainerVar);    if (! idnode)        return NS_ERROR_OUT_OF_MEMORY;    mRules.GetRoot()->AddChild(idnode);    mRules.AddNode(idnode);    // Create (?container ^member ?member)    RDFContainerMemberTestNode* membernode =        new RDFContainerMemberTestNode(idnode,                                       mConflictSet,                                       mDB,                                       mContainmentProperties,                                       mContainerVar,                                       mMemberVar);    if (! membernode)        return NS_ERROR_OUT_OF_MEMORY;    idnode->AddChild(membernode);    mRules.AddNode(membernode);    mRDFTests.Add(membernode);    *aChildNode = membernode;    return NS_OK;}