nsCOMPtr<nsIContent> firstGeneratedChild; rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(firstGeneratedChild));
nsCOMPtr<nsIContent> container; PRInt32 newIndex; rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(container), &newIndex);
RDFGenericBuilderImpl::OpenContainer(nsIContent* aElement){    nsresult rv;    // First, make sure that the element is in the right widget -- ours.    if (!IsElementInWidget(aElement))        return NS_OK;    nsCOMPtr<nsIRDFResource> resource;    rv = gXULUtils->GetElementRefResource(aElement, getter_AddRefs(resource));    // If it has no resource, there's nothing that we need to be    // concerned about here.    if (NS_FAILED(rv))        return NS_OK;    // The element has a resource; that means that it corresponds    // to something in the graph, so we need to go to the graph to    // create its contents.    //    // Create the container's contents "quietly" (i.e., |aNotify ==    // PR_FALSE|), and then use the |firstGeneratedChild| to notify    // layout where content got created.    nsCOMPtr<nsIContent> firstGeneratedChild;    rv = CreateContainerContents(aElement, resource, PR_FALSE, getter_AddRefs(firstGeneratedChild));    if (NS_FAILED(rv)) return rv;    if (firstGeneratedChild) {        nsCOMPtr<nsIContent> parent;        rv = firstGeneratedChild->GetParent(*getter_AddRefs(parent));        if (NS_FAILED(rv)) return rv;        NS_ASSERTION(parent != nsnull, "generated child has no parent");        if (! parent)            return NS_ERROR_UNEXPECTED;        PRInt32 indx;        rv = parent->IndexOf(firstGeneratedChild, indx);        if (NS_FAILED(rv)) return rv;        NS_ASSERTION(indx != -1, "generated child not found in parent");        if (indx == -1)            return NS_ERROR_UNEXPECTED;                nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);        if (! doc)            return NS_ERROR_UNEXPECTED;        rv = doc->ContentAppended(parent, indx);        if (NS_FAILED(rv)) return rv;    }    return NS_OK;}