nsAutoString ns; nsresult rv = NS_OK; if (mResolver) { mResolver->LookupNamespaceURI(prefix, ns); NS_ENSURE_SUCCESS(rv, rv); }  aID = kNameSpaceID_None; if (ns.IsEmpty()) { return NS_OK; } if (!mResolver) { aID = kNameSpaceID_Unknown; return NS_OK; }  if (!mNSMan) { mNSMan = do_CreateInstance(kNameSpaceManagerCID); if (!mNSMan) { return NS_ERROR_FAILURE; } }   return mNSMan->RegisterNameSpace(ns, aID); }
nsresult nsXPathEvaluator::ParseContextImpl::resolveNamespacePrefix    (txAtom* aPrefix, PRInt32& aID){    nsAutoString prefix;    if (aPrefix) {        aPrefix->ToString(prefix);    }    nsAutoString ns;    nsresult rv = NS_OK;    if (mResolver) {        mResolver->LookupNamespaceURI(prefix, ns);        NS_ENSURE_SUCCESS(rv, rv);    }    aID = kNameSpaceID_None;    if (ns.IsEmpty()) {        return NS_OK;    }    if (!mResolver) {        aID = kNameSpaceID_Unknown;        return NS_OK;    }    if (!mNSMan) {        mNSMan = do_CreateInstance(kNameSpaceManagerCID);        if (!mNSMan) {            return NS_ERROR_FAILURE;        }    }    // get the namespaceID for the URI    return mNSMan->RegisterNameSpace(ns, aID);}