mWrapColumn, mPrettyPrint);
mWrapColumn, mFlags);
nsTextEncoder::EncodeToStream(nsIOutputStream* aStream){  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;      mDocument->CreateXIF(buffer,mSelection);            nsString*     charset = nsnull;      nsAutoString  defaultCharset("ISO-8859-1");      if (!mCharset.Equals("null") && !mCharset.Equals(""))        charset = &mCharset;       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_OK == rv) {        nsIHTMLContentSink* sink = nsnull;        if (mMimeType == "text/html")          rv = NS_New_HTML_ContentSinkStream(&sink, aStream, charset,                                             PR_FALSE,                                             mSelection ? PR_FALSE : mAddHeader);        else          rv = NS_New_HTMLToTXT_SinkStream(&sink, aStream, charset,                                           mWrapColumn, mPrettyPrint);        	if (sink && NS_SUCCEEDED(rv))        {	        if (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;}