nsIParser* parser;
mRange = nsnull; } else { nsCOMPtr<nsIDOMNode> doc(do_QueryInterface(mDocument));
nsTextEncoder::EncodeToString(nsAWritableString& aOutputString){ nsresult rv;  if (!mDocument)    return NS_ERROR_NOT_INITIALIZED;  // xxx Also make sure mString is a mime type "text/html" or "text/plain"    if (mDocument)  {    nsString buffer;    if (mMimeType.EqualsWithConversion("text/xif"))    {      mDocument->CreateXIF(aOutputString, mSelection);      return NS_OK;    }    mDocument->CreateXIF(buffer, mSelection);    nsIParser* parser;    rv = nsComponentManager::CreateInstance(kCParserCID,                                             nsnull,                                             kCParserIID,                                             (void **)&parser);    if (NS_SUCCEEDED(rv))    {      nsIHTMLContentSink* sink = nsnull;      if (mMimeType.EqualsWithConversion("text/html"))        rv = NS_New_HTML_ContentSinkStream(&sink, &aOutputString, mFlags);      else  // default to text/plain        rv = NS_New_HTMLToTXT_SinkStream(&sink, &aOutputString,                                         mWrapColumn, mFlags);      if (sink && NS_SUCCEEDED(rv))      {        parser->SetContentSink(sink);        nsIDTD* dtd = nsnull;        rv = NS_NewXIFDTD(&dtd);        if (NS_SUCCEEDED(rv))        {          parser->RegisterDTD(dtd);          parser->Parse(buffer, 0, NS_ConvertToString("text/xif"), PR_FALSE, PR_TRUE);        }        NS_IF_RELEASE(dtd);        NS_IF_RELEASE(sink);      }      NS_RELEASE(parser);    }	}  return rv;}