rv = container->Init(mInner, kNC_BookmarksRoot);
if (nsnull != mIEFavoritesRoot) { if (!PL_strcmp(aURL, mIEFavoritesRoot)) { mFoundIEFavoritesRoot = PR_TRUE; } }  rv = mDataSource->Assert(bookmark, kRDF_type, aNodeType, PR_TRUE); if (rv != NS_RDF_ASSERTION_ACCEPTED) { NS_ERROR("unable to add bookmark to data source"); return rv; }  if ((nsnull != aOptionalTitle) && (*aOptionalTitle != PRUnichar('\0'))) { nsCOMPtr<nsIRDFLiteral> literal; if (NS_FAILED(rv = gRDF->GetLiteral(aOptionalTitle, getter_AddRefs(literal)))) { NS_ERROR("unable to create literal for bookmark name"); return rv; }  rv = mDataSource->Assert(bookmark, kNC_Name, literal, PR_TRUE); if (rv != NS_RDF_ASSERTION_ACCEPTED) { NS_ERROR("unable to set bookmark name"); return rv; } }  AssertTime(bookmark, kNC_BookmarkAddDate, aAddDate); AssertTime(bookmark, kWEB_LastVisitDate, aLastVisitDate); AssertTime(bookmark, kWEB_LastModifiedDate, aLastModifiedDate);  if ((nsnull != aShortcutURL) && (*aShortcutURL != '\0')) { nsCOMPtr<nsIRDFLiteral> shortcutLiteral; if (NS_FAILED(rv = gRDF->GetLiteral(nsAutoString(aShortcutURL).GetUnicode(), getter_AddRefs(shortcutLiteral)))) { NS_ERROR("unable to get literal for bookmark shortcut URL"); return(rv); } if (rv != NS_RDF_NO_VALUE) { rv = mDataSource->Assert(bookmark, kNC_ShortcutURL, shortcutLiteral, PR_TRUE);  if (rv != NS_RDF_ASSERTION_ACCEPTED) { NS_ERROR("unable to set bookmark shortcut URL"); return(rv); } } }    rv = aContainer->AppendElement(bookmark); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add bookmark to container");
nsBookmarksService::AddBookmark(const char *aURI, const PRUnichar *aOptionalTitle){    // XXX For the moment, just add it as a child of    // BookmarksRoot. Constructing a parser object to do this is so    // gross. We need to factor AddBookmark() into its own little    // routine or something.	BookmarkParser parser;	parser.Init(nsnull, mInner);	nsresult rv;    nsCOMPtr<nsIRDFContainer> container;	rv = nsComponentManager::CreateInstance(kRDFContainerCID,											nsnull,											nsIRDFContainer::GetIID(),											getter_AddRefs(container));    if (NS_FAILED(rv)) return rv;	rv = container->Init(mInner, kNC_BookmarksRoot);	if (NS_FAILED(rv)) return rv;	rv = parser.AddBookmark(container, aURI, aOptionalTitle,							0L, 0L, 0L, nsnull, kNC_Bookmark, nsnull);	if (NS_FAILED(rv)) return rv;	rv = Flush();	if (NS_FAILED(rv)) return rv;	return NS_OK;}