ef = gDefaultElementFactory;
ef = mDefaultElementFactory;
NameSpaceManagerImpl::GetElementFactory(PRInt32 aNameSpaceID,                                        nsIElementFactory **aElementFactory){  NS_ASSERTION(!gNameSpaceManagerWasShutDown,               "Namespace manager used past content module shutdown!!!");  *aElementFactory = nsnull;  NS_ENSURE_TRUE(gElementFactoryArray, NS_ERROR_NOT_INITIALIZED);  NS_ENSURE_TRUE(aNameSpaceID >= 0, NS_ERROR_ILLEGAL_VALUE);  gElementFactoryArray->QueryElementAt(aNameSpaceID,                                       NS_GET_IID(nsIElementFactory),                                       (void **)aElementFactory);  if (*aElementFactory) {    return NS_OK;  }  nsAutoString uri;  GetNameSpaceURI(aNameSpaceID, uri);  nsCOMPtr<nsIElementFactory> ef;  if (!uri.IsEmpty()) {    nsCAutoString contract_id(NS_ELEMENT_FACTORY_CONTRACTID_PREFIX);    contract_id.Append(NS_ConvertUCS2toUTF8(uri));    ef = do_GetService(contract_id.get());  }  if (!ef) {    ef = gDefaultElementFactory;  }  PRUint32 count = 0;  gElementFactoryArray->Count(&count);  if ((PRUint32)aNameSpaceID < count) {    gElementFactoryArray->ReplaceElementAt(ef, aNameSpaceID);  } else {    // This sucks, simply doing an InsertElementAt() should IMNSHO    // automatically grow the array and insert null's as needed to    // fill up the array!?!!    for (PRInt32 i = count; i < aNameSpaceID; i++) {      gElementFactoryArray->AppendElement(nsnull);    }    gElementFactoryArray->AppendElement(ef);  }  *aElementFactory = ef;  NS_ADDREF(*aElementFactory);  return NS_OK;}