nsCOMPtr<nsIRDFContainer> container; rv = nsComponentManager::CreateInstance(kRDFContainerCID, nsnull, NS_GET_IID(nsIRDFContainer), getter_AddRefs(container));
nsresult rv; nsCOMPtr<nsIRDFContainer> container = do_CreateInstance(kRDFContainerCID, &rv);
BookmarkParser::Parse(nsIRDFResource *aContainer, nsIRDFResource *nodeType){    // tokenize the input stream.    // XXX this needs to handle quotes, etc. it'd be nice to use the real parser for this...    nsresult            rv;    nsCOMPtr<nsIRDFContainer> container;    rv = nsComponentManager::CreateInstance(kRDFContainerCID,                        nsnull,                        NS_GET_IID(nsIRDFContainer),                        getter_AddRefs(container));    if (NS_FAILED(rv)) return rv;    rv = container->Init(mDataSource, aContainer);    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIRDFResource>    bookmarkNode = aContainer;    nsAutoString            description, line;    PRBool              isActiveFlag = PR_TRUE, inDescriptionFlag = PR_FALSE;    if ((mContents) && (mContentsLen > 0))    {        // we were able to read the entire bookmark file into memory, so process it        char                *linePtr;        PRInt32             eol;        while ((isActiveFlag == PR_TRUE) && (mStartOffset < (signed)mContentsLen))        {            linePtr = &mContents[mStartOffset];            eol = getEOL(mContents, mStartOffset, mContentsLen);            PRInt32 aLength;            if ((eol >= mStartOffset) && (eol < (signed)mContentsLen))            {                // mContents[eol] = '\0';                aLength = eol - mStartOffset;                mStartOffset = eol + 1;            }            else            {                aLength = mContentsLen - mStartOffset;                mStartOffset = mContentsLen + 1;                isActiveFlag = PR_FALSE;            }            if (aLength < 1)    continue;            line.Truncate();            DecodeBuffer(line, linePtr, aLength);            rv = ProcessLine(container, nodeType, bookmarkNode,                line, description, inDescriptionFlag, isActiveFlag);            if (NS_FAILED(rv))  break;        }    }    else    {        NS_ENSURE_TRUE(mInputStream, NS_ERROR_NULL_POINTER);        // we were unable to read in the entire bookmark file at once,        // so let's try reading it in a bit at a time instead, and process it        nsCOMPtr<nsILineInputStream> lineInputStream =            do_QueryInterface(mInputStream);        NS_ENSURE_TRUE(lineInputStream, NS_NOINTERFACE);        PRBool moreData = PR_TRUE;        while(NS_SUCCEEDED(rv) && isActiveFlag && moreData)        {            nsCAutoString cLine;            rv = lineInputStream->ReadLine(cLine, &moreData);            if (NS_SUCCEEDED(rv))            {                CopyASCIItoUTF16(cLine, line);                rv = ProcessLine(container, nodeType, bookmarkNode,                    line, description, inDescriptionFlag, isActiveFlag);            }        }    }    return rv;}