switch (aFormat->mMethod) { case eXMLOutput: *aHandler = new txXMLOutput(aFormat, mStream); break;  case eHTMLOutput: *aHandler = new txHTMLOutput(aFormat, mStream); break;  case eTextOutput: *aHandler = new txTextOutput(mStream); break;  case eMethodNotSet: *aHandler = new txUnknownHandler(mPs); break; } NS_ENSURE_TRUE(*aHandler, NS_ERROR_OUT_OF_MEMORY); return NS_OK;
NS_ASSERTION(aFormat->mMethod != eMethodNotSet, "How can method not be known when root element is?"); NS_ENSURE_TRUE(aFormat->mMethod != eMethodNotSet, NS_ERROR_UNEXPECTED); return createHandlerWith(aFormat, aHandler);
txStandaloneHandlerFactory::createHandlerWith(txOutputFormat* aFormat,                                              txIOutputXMLEventHandler** aHandler){    *aHandler = 0;    switch (aFormat->mMethod) {        case eXMLOutput:            *aHandler = new txXMLOutput(aFormat, mStream);            break;        case eHTMLOutput:            *aHandler = new txHTMLOutput(aFormat, mStream);            break;        case eTextOutput:            *aHandler = new txTextOutput(mStream);            break;        case eMethodNotSet:            *aHandler = new txUnknownHandler(mPs);            break;    }    NS_ENSURE_TRUE(*aHandler, NS_ERROR_OUT_OF_MEMORY);    return NS_OK;}