const nsString& aNamespaceURI, const nsString& aQualifiedName,
const nsAReadableString& aNamespaceURI, const nsAReadableString& aQualifiedName,
NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,                  const nsString& aNamespaceURI,                   const nsString& aQualifiedName,                   nsIDOMDocumentType* aDoctype,                  nsIURI* aBaseURI){  nsresult rv;  *aInstancePtrResult = nsnull;  nsXMLDocument* doc = new nsXMLDocument();  if (doc == nsnull)    return NS_ERROR_OUT_OF_MEMORY;  rv = doc->Reset(nsnull, nsnull);  if (NS_FAILED(rv)) {    delete doc;    return rv;  }  doc->SetDocumentURL(aBaseURI);  if (aDoctype) {    nsCOMPtr<nsIDOMNode> tmpNode;    doc->AppendChild(aDoctype, getter_AddRefs(tmpNode));  }    if (aQualifiedName.Length() > 0) {    nsCOMPtr<nsIDOMElement> root;    rv = doc->CreateElementNS(aNamespaceURI, aQualifiedName, getter_AddRefs(root));    if (NS_SUCCEEDED(rv)) {      nsCOMPtr<nsIContent> content = do_QueryInterface(root);      doc->SetRootContent(content);    }  }  return doc->QueryInterface(kIDOMDocumentIID, (void**) aInstancePtrResult);}