nsCOMPtr<nsIDOMNode> parent; aNode->GetParentNode(getter_AddRefs(parent)); if (parent) { parent->GetNodeType(&type); if (type == nsIDOMNode::DOCUMENT_NODE) { aStr.Append((PRUnichar)'\n'); } }
nsDocumentEncoder::SerializeNodeEnd(nsIDOMNode* aNode,                                    nsAString& aStr){  PRUint16 type;  aNode->GetNodeType(&type);  switch (type) {    case nsIDOMNode::ELEMENT_NODE:    {      nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);      mSerializer->AppendElementEnd(element, aStr);      break;    }  }  nsCOMPtr<nsIDOMNode> parent;  aNode->GetParentNode(getter_AddRefs(parent));  if (parent) {    parent->GetNodeType(&type);    if (type == nsIDOMNode::DOCUMENT_NODE) {        aStr.Append((PRUnichar)'\n');    }  }  return NS_OK;}