NS_PRECONDITION(aElement, "null ptr"); mRoot = aElement; return LoadDataSources();
if (gRefCnt++ == 0) { nsXULAtoms::AddRef();  kTrueStr.AssignWithConversion("true"); kFalseStr.AssignWithConversion("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(NS_ConvertASCIItoUCS2(kXULNameSpaceURI), kNameSpaceID_XUL); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XUL namespace"); if (NS_FAILED(rv)) return rv;  rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(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 "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("nsXULTemplateBuilder"); #endif  return NS_OK;
nsXULTemplateBuilder::Init(nsIContent* aElement){    NS_PRECONDITION(aElement, "null ptr");    mRoot = aElement;    return LoadDataSources();}