txToFragmentHandlerFactory::createHandlerWith(txOutputFormat* aFormat, txIOutputXMLEventHandler** aHandler)
txToDocHandlerFactory::createHandlerWith(txOutputFormat* aFormat, const String& aName, PRInt32 aNsID, txIOutputXMLEventHandler** aHandler)
txToFragmentHandlerFactory::createHandlerWith(txOutputFormat* aFormat,                                              txIOutputXMLEventHandler** aHandler){    *aHandler = nsnull;    switch (aFormat->mMethod) {        case eMethodNotSet:        {            txOutputFormat format;            format.merge(*aFormat);            nsCOMPtr<nsIDOMDocument> doc;            mFragment->GetOwnerDocument(getter_AddRefs(doc));            NS_ASSERTION(doc, "unable to get ownerdocument");            // Need a way for testing xhtml vs. html. But this is the best            // we can do for now.            nsCOMPtr<nsIHTMLDocument> htmldoc = do_QueryInterface(doc);            format.mMethod = htmldoc ? eHTMLOutput : eXMLOutput;            *aHandler = new txMozillaXMLOutput(&format, mFragment);            break;        }        case eXMLOutput:        case eHTMLOutput:        {            *aHandler = new txMozillaXMLOutput(aFormat, mFragment);            break;        }        case eTextOutput:        {            *aHandler = new txMozillaTextOutput(mFragment);            break;        }    }    NS_ENSURE_TRUE(*aHandler, NS_ERROR_OUT_OF_MEMORY);    return NS_OK;}