mWrapColumn, mPrettyPrint);
mWrapColumn, mFlags);
nsTextEncoder::EncodeToString(nsString& aOutputString){ nsresult rv;  if (!mDocument)    return NS_ERROR_NOT_INITIALIZED;  if (!mPresShell)    return NS_ERROR_NOT_INITIALIZED;  // xxx Also make sure mString is a mime type "text/html" or "text/plain"    if (mPresShell)  {    if (mDocument)    {      nsString buffer;      if (mMimeType == "text/xif")      {        mDocument->CreateXIF(aOutputString, mSelection);        return NS_OK;      }      mDocument->CreateXIF(buffer, mSelection);      nsIParser* parser;      static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID);      static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);      rv = nsComponentManager::CreateInstance(kCParserCID,                                               nsnull,                                               kCParserIID,                                               (void **)&parser);      if (NS_SUCCEEDED(rv))      {        nsIHTMLContentSink* sink = nsnull;        if (mMimeType == "text/html")          rv = NS_New_HTML_ContentSinkStream(&sink, &aOutputString,                                             PR_FALSE,                                             mSelection ? PR_FALSE : mAddHeader );        else  // default to text/plain          rv = NS_New_HTMLToTXT_SinkStream(&sink, &aOutputString,                                           mWrapColumn, mPrettyPrint);        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, "text/xif", PR_FALSE, PR_TRUE);          }          NS_IF_RELEASE(dtd);          NS_IF_RELEASE(sink);        }        NS_RELEASE(parser);      }  	}	}  return rv;}