NS_ASSERTION(NS_SUCCEEDED(rv), "unable to parse tag name"); if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) { #ifdef PR_LOGGING char* tagNameStr = aTagName.ToNewCString(); PR_LOG(gXULLog, PR_LOG_ERROR, ("xul[CreateElement] unable to parse tag '%s'; no such namespace.", tagNameStr)); delete[] tagNameStr; #endif return rv; }
XULDocumentImpl::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn){    NS_PRECONDITION(aReturn != nsnull, "null ptr");    if (! aReturn)        return NS_ERROR_NULL_POINTER;    nsresult rv;    nsCOMPtr<nsIAtom> name;    PRInt32 nameSpaceID;    // parse the user-provided string into a tag name and a namespace ID    rv = ParseTagString(aTagName, *getter_AddRefs(name), nameSpaceID);    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to parse tag name");    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIContent> result;    rv = mXULBuilder->CreateElement(nameSpaceID, name, nsnull, getter_AddRefs(result));    if (NS_FAILED(rv)) return rv;    // get the DOM interface    rv = result->QueryInterface(nsIDOMElement::GetIID(), (void**) aReturn);    NS_ASSERTION(NS_SUCCEEDED(rv), "not a DOM element");    if (NS_FAILED(rv)) return rv;    return NS_OK;}