if (colon && (DOMStringIsNull(aNamespaceURI) || (Substring(qName.get(), colon).Equals(NS_LITERAL_STRING("xml")) && !aNamespaceURI.Equals(NS_LITERAL_STRING("http: return NS_ERROR_DOM_NAMESPACE_ERR; } } else if (DOMStringIsNull(aQualifiedName) && !DOMStringIsNull(aNamespaceURI)) { return NS_ERROR_DOM_NAMESPACE_ERR;
nsDOMImplementation::CreateDocument(const nsAString& aNamespaceURI,                                    const nsAString& aQualifiedName,                                    nsIDOMDocumentType* aDoctype,                                    nsIDOMDocument** aReturn){  *aReturn = nsnull;  nsresult rv;  if (!aQualifiedName.IsEmpty()) {    rv = nsContentUtils::CheckQName(aQualifiedName);    NS_ENSURE_SUCCESS(rv, rv);  }  if (aDoctype) {    nsCOMPtr<nsIDOMDocument> owner;    aDoctype->GetOwnerDocument(getter_AddRefs(owner));    if (owner) {      return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;    }  }  rv = NS_NewDOMDocument(aReturn, aNamespaceURI, aQualifiedName, aDoctype,                         mBaseURI);  nsIDocShell *docShell = nsContentUtils::GetDocShellFromCaller();  if (docShell) {    nsCOMPtr<nsIPresContext> presContext;    docShell->GetPresContext(getter_AddRefs(presContext));    if (presContext) {      nsCOMPtr<nsISupports> container = presContext->GetContainer();      nsCOMPtr<nsIDocument> document = do_QueryInterface(*aReturn);      if (document) {        document->SetContainer(container);      }    }  }  return rv;}