trueStr = "true"; falseStr = "false";  nsresult rv;    rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID, nsnull, NS_GET_IID(nsINameSpaceManager), (void**) &gNameSpaceManager); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create namespace manager"); if (NS_FAILED(rv)) return rv;   static const char kXULNameSpaceURI[] = "http:  static const char kRDFNameSpaceURI[] = RDF_NAMESPACE_URI;  rv = gNameSpaceManager->RegisterNameSpace(kXULNameSpaceURI, kNameSpaceID_XUL); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace"); if (NS_FAILED(rv)) return rv;  rv = gNameSpaceManager->RegisterNameSpace(kRDFNameSpaceURI, kNameSpaceID_RDF); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace"); if (NS_FAILED(rv)) return rv;     rv = nsServiceManager::GetService(kRDFServiceCID, NS_GET_IID(nsIRDFService), (nsISupports**) &gRDFService); if (NS_FAILED(rv)) return rv;  gRDFService->GetResource(NC_NAMESPACE_URI "Title",   &kNC_Title); gRDFService->GetResource(NC_NAMESPACE_URI "child",   &kNC_child); gRDFService->GetResource(NC_NAMESPACE_URI "Column",  &kNC_Column); gRDFService->GetResource(NC_NAMESPACE_URI "Folder",  &kNC_Folder); gRDFService->GetResource(RDF_NAMESPACE_URI "child",  &kRDF_child); gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_instanceOf); gRDFService->GetResource(XUL_NAMESPACE_URI "element",    &kXUL_element);  rv = nsServiceManager::GetService(kRDFContainerUtilsCID, NS_GET_IID(nsIRDFContainerUtils), (nsISupports**) &gRDFContainerUtils); if (NS_FAILED(rv)) return rv;  rv = nsServiceManager::GetService(kXULSortServiceCID, NS_GET_IID(nsIXULSortService), (nsISupports**) &gXULSortService); if (NS_FAILED(rv)) return rv;  rv = nsComponentManager::CreateInstance(kHTMLElementFactoryCID, nsnull, NS_GET_IID(nsIElementFactory), (void**) &gHTMLElementFactory); if (NS_FAILED(rv)) return rv;  rv = nsComponentManager::CreateInstance(kXMLElementFactoryCID, nsnull, NS_GET_IID(nsIElementFactory), (void**) &gXMLElementFactory); if (NS_FAILED(rv)) return rv;  rv = nsServiceManager::GetService(kXULContentUtilsCID, NS_GET_IID(nsIXULContentUtils), (nsISupports**) &gXULUtils); if (NS_FAILED(rv)) return rv; }  #ifdef PR_LOGGING if (! gLog) gLog = PR_NewLogModule("nsRDFGenericBuilder"); #endif
mBindings = PL_NewHashTable(16,  HashMemoryElement, CompareMemoryElements, PL_CompareValues, &gBindingAllocOps, nsnull );
RDFGenericBuilderImpl::Init(){    if (gRefCnt++ == 0) {        kContainerAtom                  = NS_NewAtom("container");        kContainmentAtom                = NS_NewAtom("containment");        kEmptyAtom                      = NS_NewAtom("empty");        kIdAtom                         = NS_NewAtom("id");        kIgnoreAtom                     = NS_NewAtom("ignore");        kInstanceOfAtom                 = NS_NewAtom("instanceOf");        kIsContainerAtom                = NS_NewAtom("iscontainer");        kIsEmptyAtom                    = NS_NewAtom("isempty");        kMenuAtom                       = NS_NewAtom("menu");        kMenuPopupAtom                  = NS_NewAtom("menupopup");        kOpenAtom                       = NS_NewAtom("open");        kParentAtom                     = NS_NewAtom("parent");        kPersistAtom                    = NS_NewAtom("persist");        kPropertyAtom                   = NS_NewAtom("property");        kResourceAtom                   = NS_NewAtom("resource");        kRuleAtom                       = NS_NewAtom("rule");        kTemplateAtom                   = NS_NewAtom("template");        kTextNodeAtom                   = NS_NewAtom("textnode");        kTreeAtom                       = NS_NewAtom("tree");        kTreeChildrenAtom               = NS_NewAtom("treechildren");        kTreeItemAtom                   = NS_NewAtom("treeitem");        kURIAtom                        = NS_NewAtom("uri");        kValueAtom                      = NS_NewAtom("value");        kXULContentsGeneratedAtom       = NS_NewAtom("xulcontentsgenerated");    trueStr = "true";    falseStr = "false";        nsresult rv;        // Register the XUL and RDF namespaces: these'll just retrieve        // the IDs if they've already been registered by someone else.        rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,                                                nsnull,                                                NS_GET_IID(nsINameSpaceManager),                                                (void**) &gNameSpaceManager);        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create namespace manager");        if (NS_FAILED(rv)) return rv;        // XXX This is sure to change. Copied from mozilla/layout/xul/content/src/nsXULAtoms.cpp        static const char kXULNameSpaceURI[]            = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";        static const char kRDFNameSpaceURI[]            = RDF_NAMESPACE_URI;        rv = gNameSpaceManager->RegisterNameSpace(kXULNameSpaceURI, kNameSpaceID_XUL);        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace");        if (NS_FAILED(rv)) return rv;        rv = gNameSpaceManager->RegisterNameSpace(kRDFNameSpaceURI, kNameSpaceID_RDF);        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace");        if (NS_FAILED(rv)) return rv;        // Initialize the global shared reference to the service        // manager and get some shared resource objects.        rv = nsServiceManager::GetService(kRDFServiceCID,                                          NS_GET_IID(nsIRDFService),                                          (nsISupports**) &gRDFService);        if (NS_FAILED(rv)) return rv;        gRDFService->GetResource(NC_NAMESPACE_URI "Title",   &kNC_Title);        gRDFService->GetResource(NC_NAMESPACE_URI "child",   &kNC_child);        gRDFService->GetResource(NC_NAMESPACE_URI "Column",  &kNC_Column);        gRDFService->GetResource(NC_NAMESPACE_URI "Folder",  &kNC_Folder);        gRDFService->GetResource(RDF_NAMESPACE_URI "child",  &kRDF_child);        gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_instanceOf);        gRDFService->GetResource(XUL_NAMESPACE_URI "element",    &kXUL_element);        rv = nsServiceManager::GetService(kRDFContainerUtilsCID,                                          NS_GET_IID(nsIRDFContainerUtils),                                          (nsISupports**) &gRDFContainerUtils);        if (NS_FAILED(rv)) return rv;        rv = nsServiceManager::GetService(kXULSortServiceCID,                                          NS_GET_IID(nsIXULSortService),                                          (nsISupports**) &gXULSortService);        if (NS_FAILED(rv)) return rv;        rv = nsComponentManager::CreateInstance(kHTMLElementFactoryCID,                                                nsnull,                                                NS_GET_IID(nsIElementFactory),                                                (void**) &gHTMLElementFactory);        if (NS_FAILED(rv)) return rv;        rv = nsComponentManager::CreateInstance(kXMLElementFactoryCID,                                                nsnull,                                                NS_GET_IID(nsIElementFactory),                                                (void**) &gXMLElementFactory);        if (NS_FAILED(rv)) return rv;        rv = nsServiceManager::GetService(kXULContentUtilsCID,                                          NS_GET_IID(nsIXULContentUtils),                                          (nsISupports**) &gXULUtils);        if (NS_FAILED(rv)) return rv;    }#ifdef PR_LOGGING    if (! gLog)        gLog = PR_NewLogModule("nsRDFGenericBuilder");#endif    return NS_OK;}