nsCOMPtr<nsIDOMNodeList> children; nsresult rv = mElement->GetChildNodes(getter_AddRefs(children)); NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIDOMNode> childNode, childAnonymousNode, nodeReturn; nsCOMPtr<nsIXFormsSelectChild> childItem;  PRUint32 childCount = 0; children->GetLength(&childCount);  for (PRUint32 i = 0; i < childCount; ++i) { children->Item(i, getter_AddRefs(childNode)); childItem = do_QueryInterface(childNode); if (childItem) { nsCOMPtr<nsIArray> childItems; childItem->GetAnonymousNodes(getter_AddRefs(childItems)); if (childItems) { PRUint32 childNodesLength = 0; childItems->GetLength(&childNodesLength);  for (PRUint32 j = 0; j < childNodesLength; ++j) { childAnonymousNode = do_QueryElementAt(childItems, j); mOptGroup->AppendChild(childAnonymousNode, getter_AddRefs(nodeReturn)); } } } }
nsXFormsChoicesElement::DoneAddingChildren(){  // Unsuppress notifications  nsCOMPtr<nsIXTFElementWrapper> wrapper = do_QueryInterface(mElement);  NS_ASSERTION(wrapper, "huh? our element must be an xtf wrapper");  wrapper->SetNotificationMask(nsIXTFElement::NOTIFY_PARENT_CHANGED |                               nsIXTFElement::NOTIFY_CHILD_INSERTED |                               nsIXTFElement::NOTIFY_CHILD_APPENDED |                               nsIXTFElement::NOTIFY_CHILD_REMOVED);  // Walk our children and get their anonymous content.  nsCOMPtr<nsIDOMNodeList> children;  nsresult rv = mElement->GetChildNodes(getter_AddRefs(children));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIDOMNode> childNode, childAnonymousNode, nodeReturn;  nsCOMPtr<nsIXFormsSelectChild> childItem;  PRUint32 childCount = 0;  children->GetLength(&childCount);  for (PRUint32 i = 0; i < childCount; ++i) {    children->Item(i, getter_AddRefs(childNode));    childItem = do_QueryInterface(childNode);    if (childItem) {      nsCOMPtr<nsIArray> childItems;      childItem->GetAnonymousNodes(getter_AddRefs(childItems));      if (childItems) {        PRUint32 childNodesLength = 0;        childItems->GetLength(&childNodesLength);        for (PRUint32 j = 0; j < childNodesLength; ++j) {          childAnonymousNode = do_QueryElementAt(childItems, j);          mOptGroup->AppendChild(childAnonymousNode,                                 getter_AddRefs(nodeReturn));        }      }    }  }  // Assume that we've got something worth refreshing now.  Refresh();  return NS_OK;}