nsAutoString headTag; headTag.AssignWithConversion("head");
nsAutoString headTag; headTag.Assign(NS_LITERAL_STRING("head"));
static nsresult SetSelectionAroundHeadChildren(nsCOMPtr<nsISelection> aSelection, nsWeakPtr aDocWeak){  nsresult res = NS_OK;  // Set selection around <head> node  nsCOMPtr<nsIDOMNodeList>nodeList;   nsAutoString headTag; headTag.AssignWithConversion("head");   nsCOMPtr<nsIDOMDocument> doc = do_QueryReferent(aDocWeak);  if (!doc) return NS_ERROR_NOT_INITIALIZED;  res = doc->GetElementsByTagName(headTag, getter_AddRefs(nodeList));  if (NS_FAILED(res)) return res;  if (!nodeList) return NS_ERROR_NULL_POINTER;  PRUint32 count;   nodeList->GetLength(&count);  if (count < 1) return NS_ERROR_FAILURE;  nsCOMPtr<nsIDOMNode> headNode;  res = nodeList->Item(0, getter_AddRefs(headNode));   if (NS_FAILED(res)) return res;  if (!headNode) return NS_ERROR_NULL_POINTER;  // Collapse selection to before first child of the head,  res = aSelection->Collapse(headNode, 0);  if (NS_FAILED(res)) return res;  //  then extend it to just after  nsCOMPtr<nsIDOMNodeList> childNodes;  res = headNode->GetChildNodes(getter_AddRefs(childNodes));  if (NS_FAILED(res)) return res;  if (!childNodes) return NS_ERROR_NULL_POINTER;  PRUint32 childCount;  childNodes->GetLength(&childCount);  return aSelection->Extend(headNode, childCount+1);}