parser->SetContentSink(aSink);
parser->SetContentSink(sink);
txCompileObserver::startLoad(nsIURI* aUri, txStylesheetSink* aSink,                             nsIURI* aReferrerUri){    nsCOMPtr<nsIChannel> channel;    nsresult rv = NS_NewChannel(getter_AddRefs(channel), aUri);    NS_ENSURE_SUCCESS(rv, rv);    channel->SetLoadGroup(mLoadGroup);    nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));    if (httpChannel) {        httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),                                      NS_LITERAL_CSTRING("text/xml,application/xml,application/xhtml+xml,*/*;q=0.1"),                                      PR_FALSE);        if (aReferrerUri) {            httpChannel->SetReferrer(aReferrerUri);        }    }    nsAutoString charset(NS_LITERAL_STRING("UTF-8"));    PRInt32 charsetSource = kCharsetFromDocTypeDefault;    // check channel's charset...    nsCAutoString charsetVal;    rv = channel->GetContentCharset(charsetVal);    if (NS_SUCCEEDED(rv)) {        nsCOMPtr<nsICharsetAlias> calias =            do_GetService(NS_CHARSETALIAS_CONTRACTID);        if (calias) {            nsAutoString preferred;            rv = calias->GetPreferred(NS_ConvertASCIItoUCS2(charsetVal),                                      preferred);            if (NS_SUCCEEDED(rv)) {                            charset = preferred;                charsetSource = kCharsetFromChannel;             }        }    }    static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);    nsCOMPtr<nsIParser> parser = do_CreateInstance(kCParserCID, &rv);    NS_ENSURE_SUCCESS(rv, rv);    // Set the parser as the stream listener for the document loader...    nsCOMPtr<nsIStreamListener> listener = do_QueryInterface(parser, &rv);    NS_ENSURE_TRUE(listener, rv);    parser->SetDocumentCharset(charset, charsetSource);    parser->SetCommand(kLoadAsData);    parser->SetContentSink(aSink);    parser->Parse(aUri);    return channel->AsyncOpen(listener, nsnull);}