From 11bee269364f13883667df74db5fd6283f235fc5 Mon Sep 17 00:00:00 2001 From: "peterv%netscape.com" Date: Mon, 1 Jul 2002 15:12:55 +0000 Subject: [PATCH] More. git-svn-id: svn://10.0.0.236/branches/XSLTPROCESSOR_REFACTOR_20020630_BRANCH@124402 18797224-902f-48f8-a5cc-f745e15eee43 --- .../source/xslt/XSLTProcessor.cpp | 5 ++ .../source/xslt/txMozillaXSLTProcessor.h | 3 +- .../source/xslt/txStandaloneXSLTProcessor.cpp | 60 +++++++++++------ .../source/xslt/txStandaloneXSLTProcessor.h | 64 +++++++++++++------ 4 files changed, 90 insertions(+), 42 deletions(-) diff --git a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp index 91b6f31d656..9a813683fc8 100644 --- a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp @@ -1587,7 +1587,12 @@ txXSLTProcessor::startElement(const String& aName, format->mMethod = eXMLOutput; } mOutputHandler = aPs->getProcessorHelper()->getOutputHandler(format->mMethod); + if (!mOutputHandler) { + // XXX Error + return; + } mOutputHandler->setOutputFormat(format); + mResultHandler = mOutputHandler; } mHaveDocumentElement = MB_TRUE; } diff --git a/mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.h b/mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.h index 4a4f396dd33..3894c607df0 100644 --- a/mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.h +++ b/mozilla/extensions/transformiix/source/xslt/txMozillaXSLTProcessor.h @@ -120,9 +120,8 @@ public: void logMessage(const String& aMessage); Document* createRTFDocument(txOutputMethod aMethod); - nsCOMPtr mMozillaOutputHandler; - private: + nsCOMPtr mMozillaOutputHandler; nsCOMPtr mSourceDocument; nsWeakPtr mObserver; }; diff --git a/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp b/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp index 62ab7cd0635..7e27e062406 100644 --- a/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp @@ -1,26 +1,41 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ * - * The Original Code is TransforMiiX XSLT processor. + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. * - * The Initial Developer of the Original Code is The MITRE Corporation. - * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. + * The Original Code is mozilla.org code. * - * Portions created by Keith Visco as a Non MITRE employee, - * (C) 1999, 2000 Keith Visco. All Rights Reserved. + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Keith Visco, kvisco@ziplink.net - * -- original author. - */ + * Peter Van der Beken (original author) + * + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #include "txStandaloneXSLTProcessor.h" @@ -402,7 +417,7 @@ void txStandaloneXSLTProcessor::parseStylesheetPI(String& data, } txOutputXMLEventHandler* -txStandaloneXSLTProcessor::getOutputHandler(txOutputMethod aMethod) +txStandaloneHelper::getOutputHandler(txOutputMethod aMethod) { if (mStandaloneOutputHandler) { if (aMethod == eHTMLOutput || aMethod == eXMLOutput) { @@ -455,7 +470,14 @@ txStandaloneXSLTProcessor::getOutputHandler(txOutputMethod aMethod) } void -txStandaloneXSLTProcessor::logMessage(const String& aMessage) +txStandaloneHelper::logMessage(const String& aMessage) { cout << "xsl:message - "<< aMessage << endl; } + +Document* +txStandaloneHelper::createRTFDocument(txOutputMethod aMethod) +{ + return new Document(); +} + diff --git a/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.h b/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.h index 4e298cb48d3..67934971194 100644 --- a/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.h +++ b/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.h @@ -1,28 +1,41 @@ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ * - * The Original Code is TransforMiiX XSLT processor. + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. * - * The Initial Developer of the Original Code is The MITRE Corporation. - * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. + * The Original Code is mozilla.org code. * - * Portions created by Keith Visco as a Non MITRE employee, - * (C) 1999 Keith Visco. All Rights Reserved. + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Keith Visco, kvisco@ziplink.net - * -- original author. + * Peter Van der Beken (original author) * - */ - + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #ifndef TRANSFRMX_TXSTANDALONEXSLTPROCESSOR_H #define TRANSFRMX_TXSTANDALONEXSLTPROCESSOR_H @@ -142,9 +155,6 @@ public: ostream& out); private: - virtual txOutputXMLEventHandler* getOutputHandler(txOutputMethod aMethod); - virtual void logMessage(const String& aMessage); - Document* transform(Document& xmlDocument, Document& xslDocument, ostream& out) @@ -165,7 +175,19 @@ private: void parseStylesheetPI(String& data, String& type, String& href); +}; +class txStandaloneHelper : public txIProcessorHelper +{ +public: + txStandaloneHelper(); + virtual ~txStandaloneHelper(); + + txOutputXMLEventHandler* getOutputHandler(txOutputMethod aMethod); + void logMessage(const String& aMessage); + Document* createRTFDocument(txOutputMethod aMethod); + +private: txOutputXMLEventHandler* mStandaloneOutputHandler; ostream* mOut; };