git-svn-id: svn://10.0.0.236/branches/XSLTPROCESSOR_REFACTOR_20020630_BRANCH@124402 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterv%netscape.com
2002-07-01 15:12:55 +00:00
parent 80f7da9207
commit 11bee26936
4 changed files with 90 additions and 42 deletions

View File

@@ -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;
}

View File

@@ -120,9 +120,8 @@ public:
void logMessage(const String& aMessage);
Document* createRTFDocument(txOutputMethod aMethod);
nsCOMPtr<txIMozillaXMLEventHandler> mMozillaOutputHandler;
private:
nsCOMPtr<txIMozillaXMLEventHandler> mMozillaOutputHandler;
nsCOMPtr<nsIDOMDocument> mSourceDocument;
nsWeakPtr mObserver;
};

View File

@@ -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 <peterv@netscape.com> (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();
}

View File

@@ -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 <peterv@netscape.com> (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;
};