not part of build, code by peterv, r=me, fixing XPathProcessor, nsISynchLoader, cleanup
git-svn-id: svn://10.0.0.236/trunk@85178 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
561a3dc878
commit
fb545a174e
@ -165,7 +165,7 @@ nsSyncLoader::~nsSyncLoader()
|
||||
NS_IMPL_ISUPPORTS3(nsSyncLoader, nsISyncLoader, nsIDOMLoadListener, nsISupportsWeakReference)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDocument **_retval)
|
||||
nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -316,7 +316,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDocument **_retval)
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*_retval = document;
|
||||
*_retval = DOMDocument;
|
||||
NS_ADDREF(*_retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
* -- Removed a number of castings of XML_Char to DOM_CHAR since they
|
||||
* were not working on Windows properly
|
||||
*
|
||||
* $Id: XMLParser.cpp,v 1.11 2001-01-12 20:06:26 axel%pike.org Exp $
|
||||
* $Id: XMLParser.cpp,v 1.12 2001-01-19 21:24:39 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
#include "XMLParser.h"
|
||||
@ -96,12 +96,11 @@ Document* XMLParser::getDocumentFromURI
|
||||
nsCOMPtr<nsISyncLoader>aLoader = do_CreateInstance( TRANSFORMIIX_SYNCLOADER_CONTRACTID, &rv );
|
||||
if (NS_FAILED(rv)) return NULL;
|
||||
|
||||
nsCOMPtr <nsIDocument> theDocument;
|
||||
aLoader->LoadDocument(documentURI, getter_AddRefs(theDocument));
|
||||
nsCOMPtr<nsIDOMDocument> theDOMDocument = do_QueryInterface(theDocument, & rv);
|
||||
nsCOMPtr <nsIDOMDocument> theDocument;
|
||||
rv = aLoader->LoadDocument(documentURI, getter_AddRefs(theDocument));
|
||||
if (NS_FAILED(rv)) return NULL;
|
||||
|
||||
return new Document(theDOMDocument);
|
||||
return new Document(theDocument);
|
||||
#else
|
||||
istream* xslInput = URIUtils::getInputStream(href, documentBase, errMsg);
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ nsSyncLoader::~nsSyncLoader()
|
||||
NS_IMPL_ISUPPORTS3(nsSyncLoader, nsISyncLoader, nsIDOMLoadListener, nsISupportsWeakReference)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDocument **_retval)
|
||||
nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDOMDocument **_retval)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@ -316,7 +316,7 @@ nsSyncLoader::LoadDocument(nsIURI* documentURI, nsIDocument **_retval)
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*_retval = document;
|
||||
*_retval = DOMDocument;
|
||||
NS_ADDREF(*_retval);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ CPPSRCS = AdditiveExpr.cpp \
|
||||
MultiplicativeExpr.cpp \
|
||||
NodeSet.cpp \
|
||||
NodeSetFunctionCall.cpp \
|
||||
nsNodeSet.cpp \
|
||||
NumberExpr.cpp \
|
||||
NumberFunctionCall.cpp \
|
||||
NumberResult.cpp \
|
||||
|
||||
@ -27,36 +27,23 @@
|
||||
* Olivier Gerardin, ogerardin@vo.lu
|
||||
* -- fixed numberValue()
|
||||
*
|
||||
* $Id: NodeSet.cpp,v 1.4 2001-01-12 20:06:35 axel%pike.org Exp $
|
||||
* $Id: NodeSet.cpp,v 1.5 2001-01-19 21:24:41 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
#include "NodeSet.h"
|
||||
#include "XMLDOMUtils.h"
|
||||
#ifndef MOZ_XSL
|
||||
#include <iostream.h>
|
||||
#else
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NodeSet <BR />
|
||||
* This class was ported from XSL:P. <BR />
|
||||
* @author <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
|
||||
* @version $Revision: 1.4 $ $Date: 2001-01-12 20:06:35 $
|
||||
* @version $Revision: 1.5 $ $Date: 2001-01-19 21:24:41 $
|
||||
**/
|
||||
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
NS_IMPL_ISUPPORTS2(NodeSet,
|
||||
nsIDOMNodeList,
|
||||
nsIScriptObjectOwner)
|
||||
#endif
|
||||
|
||||
//-------------/
|
||||
//- Constants -/
|
||||
//-------------/
|
||||
@ -94,11 +81,6 @@ NodeSet::NodeSet(const NodeSet& source) {
|
||||
* Helper method for Constructors
|
||||
**/
|
||||
void NodeSet::initialize(int size) {
|
||||
#ifdef MOZ_XSL
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
mScriptObject = nsnull;
|
||||
#endif
|
||||
elements = new Node*[size];
|
||||
for ( int i = 0; i < size; i++ ) elements[i] = 0;
|
||||
elementCount = 0;
|
||||
@ -211,19 +193,6 @@ Node* NodeSet::get(int index) {
|
||||
return elements[index];
|
||||
} //-- get
|
||||
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
NS_IMETHODIMP NodeSet::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
if ((aIndex < 0) || aIndex >= (UInt32)elementCount) return NS_ERROR_INVALID_ARG;
|
||||
Node* aNode = elements[aIndex];
|
||||
if (!aNode) return NS_ERROR_INVALID_ARG;
|
||||
*aReturn = aNode->getNSNode();
|
||||
return NS_OK;
|
||||
} //-- Item
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Returns the index of the specified Node,
|
||||
* or -1 if the Node is not contained in the NodeSet
|
||||
@ -283,15 +252,6 @@ int NodeSet::size() const{
|
||||
return elementCount;
|
||||
} //-- size
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
NS_IMETHODIMP NodeSet::GetLength(PRUint32* aLength)
|
||||
{
|
||||
*aLength = elementCount;
|
||||
return NS_OK;
|
||||
} //-- GetLength
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Creates a String representation of this NodeSet
|
||||
* @param str the destination string to append the String representation to.
|
||||
@ -392,42 +352,3 @@ void NodeSet::stringValue(String& str) {
|
||||
XMLDOMUtils::getNodeValue(get(0), &str);
|
||||
}
|
||||
} //-- stringValue
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
/*
|
||||
* nsIScriptObjectOwner
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
NodeSet::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIScriptGlobalObject* global = aContext->GetGlobalObject();
|
||||
|
||||
if (nsnull == mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
if (NS_SUCCEEDED(rv = nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
|
||||
NS_GET_IID(nsIDOMScriptObjectFactory),
|
||||
(nsISupports **)&factory))) {
|
||||
rv = factory->NewScriptNodeList(aContext,
|
||||
(nsISupports*)(nsIDOMNodeList*)this,
|
||||
global,
|
||||
(void**)&mScriptObject);
|
||||
|
||||
nsServiceManager::ReleaseService(kDOMScriptObjectFactoryCID, factory);
|
||||
}
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
|
||||
NS_RELEASE(global);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NodeSet::SetScriptObject(void* aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -24,13 +24,13 @@
|
||||
* Larry Fitzpatrick, OpenText, lef@opentext.com
|
||||
* -- moved initialization of DEFAULT_SIZE to NodeSet.cpp
|
||||
*
|
||||
* $Id: NodeSet.h,v 1.4 2001-01-12 20:06:35 axel%pike.org Exp $
|
||||
* $Id: NodeSet.h,v 1.5 2001-01-19 21:24:41 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* NodeSet
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.4 $ $Date: 2001-01-12 20:06:35 $
|
||||
* @version $Revision: 1.5 $ $Date: 2001-01-19 21:24:41 $
|
||||
**/
|
||||
|
||||
#ifndef TRANSFRMX_NODESET_H
|
||||
@ -40,16 +40,7 @@
|
||||
#include "dom.h"
|
||||
#include "ExprResult.h"
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
|
||||
class NodeSet : public ExprResult,
|
||||
public nsIDOMNodeList,
|
||||
public nsIScriptObjectOwner
|
||||
#else
|
||||
class NodeSet : public ExprResult
|
||||
#endif
|
||||
{
|
||||
|
||||
public:
|
||||
@ -78,17 +69,6 @@ public:
|
||||
**/
|
||||
virtual ~NodeSet();
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDocumentTransformer interface
|
||||
NS_DECL_IDOMNODELIST
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
#endif
|
||||
/**
|
||||
* Adds the specified Node to this NodeSet if it is not already
|
||||
* contained within in this NodeSet.
|
||||
@ -219,10 +199,6 @@ private:
|
||||
//- Private Members -/
|
||||
//-------------------/
|
||||
|
||||
#ifdef MOZ_XSL
|
||||
void* mScriptObject;
|
||||
#endif
|
||||
|
||||
static const int DEFAULT_SIZE;
|
||||
|
||||
Node** elements;
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "dom.h"
|
||||
#include "ProcessorState.h"
|
||||
#include "Expr.h"
|
||||
#include "nsNodeSet.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS2(XPathProcessor,
|
||||
nsIXPathNodeSelector,
|
||||
@ -53,24 +54,27 @@ NS_IMETHODIMP XPathProcessor::SelectNodes(nsIDOMNode *aContextNode, const char *
|
||||
aContextNode->GetOwnerDocument(getter_AddRefs(aOwnerDOMDocument));
|
||||
nsCOMPtr<nsIDocument> aOwnerDocument = do_QueryInterface(aOwnerDOMDocument);
|
||||
Document* aDocument = new Document(aOwnerDOMDocument);
|
||||
Node* aNode = new Node(aContextNode, aDocument);
|
||||
Node* aNode = aDocument->createWrapper(aContextNode);
|
||||
|
||||
ProcessorState* aProcessorState = new ProcessorState(*aDocument, *aDocument);
|
||||
ExprParser* aParser = new ExprParser;
|
||||
ProcessorState* aProcessorState = new ProcessorState();
|
||||
ExprParser aParser;
|
||||
|
||||
Expr* aExpression = aParser->createExpr(aPattern);
|
||||
Expr* aExpression = aParser.createExpr(aPattern);
|
||||
ExprResult* exprResult = aExpression->evaluate(aNode, aProcessorState);
|
||||
nsNodeSet* resultSet;
|
||||
if ( exprResult->getResultType() == ExprResult::NODESET ) {
|
||||
*_retval = (NodeSet*)exprResult;
|
||||
resultSet = new nsNodeSet((NodeSet*)exprResult);
|
||||
}
|
||||
else {
|
||||
// Return an empty nodeset
|
||||
*_retval = new NodeSet(0);
|
||||
resultSet = new nsNodeSet(nsnull);
|
||||
}
|
||||
*_retval = resultSet;
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
delete aProcessorState;
|
||||
delete exprResult;
|
||||
delete aExpression;
|
||||
delete aNode;
|
||||
delete aDocument;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@ -43,8 +43,9 @@ CPPSRCS= \
|
||||
IdentityExpr.cpp \
|
||||
LocationStep.cpp \
|
||||
MultiplicativeExpr.cpp \
|
||||
NodeSet.cpp \
|
||||
NodeSet.cpp \
|
||||
NodeSetFunctionCall.cpp \
|
||||
nsNodeSet.cpp \
|
||||
NumberExpr.cpp \
|
||||
NumberFunctionCall.cpp \
|
||||
NumberResult.cpp \
|
||||
@ -86,6 +87,7 @@ CPP_OBJS= \
|
||||
.\$(OBJDIR)\MultiplicativeExpr.obj \
|
||||
.\$(OBJDIR)\NodeSet.obj \
|
||||
.\$(OBJDIR)\NodeSetFunctionCall.obj \
|
||||
.\$(OBJDIR)\nsNodeSet.obj \
|
||||
.\$(OBJDIR)\NumberExpr.obj \
|
||||
.\$(OBJDIR)\NumberFunctionCall.obj \
|
||||
.\$(OBJDIR)\NumberResult.obj \
|
||||
|
||||
102
mozilla/extensions/transformiix/source/xpath/nsNodeSet.cpp
Normal file
102
mozilla/extensions/transformiix/source/xpath/nsNodeSet.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken, peterv@netscape.com
|
||||
* -- original author.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nsNodeSet.h"
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsIDOMScriptObjectFactory.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsNodeSet,
|
||||
nsIDOMNodeList,
|
||||
nsIScriptObjectOwner)
|
||||
|
||||
nsNodeSet::nsNodeSet(NodeSet* aNodeSet) {
|
||||
NS_INIT_ISUPPORTS();
|
||||
mScriptObject = nsnull;
|
||||
|
||||
if (aNodeSet) {
|
||||
for (int i=0; i < aNodeSet->size(); i++) {
|
||||
mNodes.AppendElement(aNodeSet->get(i)->getNSNode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsNodeSet::~nsNodeSet() {
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeSet::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||
{
|
||||
*aReturn = nsnull;
|
||||
mNodes.QueryElementAt(aIndex, NS_GET_IID(nsIDOMNode), (void**)aReturn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeSet::GetLength(PRUint32* aLength)
|
||||
{
|
||||
mNodes.Count(aLength);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* nsIScriptObjectOwner
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeSet::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIScriptGlobalObject* global = aContext->GetGlobalObject();
|
||||
|
||||
if (nsnull == mScriptObject) {
|
||||
nsIDOMScriptObjectFactory *factory;
|
||||
|
||||
if (NS_SUCCEEDED(rv = nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
|
||||
NS_GET_IID(nsIDOMScriptObjectFactory),
|
||||
(nsISupports **)&factory))) {
|
||||
rv = factory->NewScriptNodeList(aContext,
|
||||
(nsISupports*)(nsIDOMNodeList*)this,
|
||||
global,
|
||||
(void**)&mScriptObject);
|
||||
|
||||
nsServiceManager::ReleaseService(kDOMScriptObjectFactoryCID, factory);
|
||||
}
|
||||
}
|
||||
*aScriptObject = mScriptObject;
|
||||
|
||||
NS_RELEASE(global);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeSet::SetScriptObject(void* aScriptObject)
|
||||
{
|
||||
mScriptObject = aScriptObject;
|
||||
return NS_OK;
|
||||
}
|
||||
63
mozilla/extensions/transformiix/source/xpath/nsNodeSet.h
Normal file
63
mozilla/extensions/transformiix/source/xpath/nsNodeSet.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Van der Beken, peterv@netscape.com
|
||||
* -- original author.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRANSFRMX_NS_NODESET_H
|
||||
#define TRANSFRMX_NS_NODESET_H
|
||||
|
||||
#include "NodeSet.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsSupportsArray.h"
|
||||
|
||||
class nsNodeSet : public nsIDOMNodeList,
|
||||
public nsIScriptObjectOwner
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates a new Mozilla NodeSet from a Transformiix NodeSet
|
||||
**/
|
||||
nsNodeSet(NodeSet* aNodeSet);
|
||||
|
||||
/**
|
||||
* Default destructor for nsNodeSet
|
||||
**/
|
||||
virtual ~nsNodeSet();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDocumentTransformer interface
|
||||
NS_DECL_IDOMNODELIST
|
||||
|
||||
// nsIScriptObjectOwner interface
|
||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
||||
|
||||
private:
|
||||
void* mScriptObject;
|
||||
nsSupportsArray mNodes;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -25,13 +25,13 @@
|
||||
* -- added code in ::resolveFunctionCall to support the
|
||||
* document() function.
|
||||
*
|
||||
* $Id: ProcessorState.cpp,v 1.13 2001-01-12 20:06:42 axel%pike.org Exp $
|
||||
* $Id: ProcessorState.cpp,v 1.14 2001-01-19 21:24:44 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of ProcessorState
|
||||
* Much of this code was ported from XSL:P
|
||||
* @version $Revision: 1.13 $ $Date: 2001-01-12 20:06:42 $
|
||||
* @version $Revision: 1.14 $ $Date: 2001-01-19 21:24:44 $
|
||||
**/
|
||||
|
||||
#include "ProcessorState.h"
|
||||
@ -43,6 +43,15 @@ const String ProcessorState::wrapperNSPrefix = "transformiix";
|
||||
const String ProcessorState::wrapperName = "transformiix:result";
|
||||
const String ProcessorState::wrapperNS = "http://www.mitre.org/TransforMiix";
|
||||
|
||||
/**
|
||||
* Creates a new ProcessorState
|
||||
**/
|
||||
ProcessorState::ProcessorState() {
|
||||
this->xslDocument = NULL;
|
||||
this->resultDocument = NULL;
|
||||
initialize();
|
||||
} //-- ProcessorState
|
||||
|
||||
/**
|
||||
* Creates a new ProcessorState for the given XSL document
|
||||
* and resultDocument
|
||||
@ -57,8 +66,10 @@ ProcessorState::ProcessorState(Document& xslDocument, Document& resultDocument)
|
||||
* Destroys this ProcessorState
|
||||
**/
|
||||
ProcessorState::~ProcessorState() {
|
||||
delete dfWildCardTemplate;
|
||||
delete dfTextTemplate;
|
||||
if (dfWildCardTemplate)
|
||||
delete dfWildCardTemplate;
|
||||
if (dfTextTemplate)
|
||||
delete dfTextTemplate;
|
||||
delete nodeStack;
|
||||
|
||||
while ( ! variableSets.empty() ) {
|
||||
@ -788,6 +799,8 @@ ProcessorState::XMLSpaceMode ProcessorState::getXMLSpaceMode(Node* node) {
|
||||
* Initializes this ProcessorState
|
||||
**/
|
||||
void ProcessorState::initialize() {
|
||||
dfWildCardTemplate = 0;
|
||||
dfTextTemplate = 0;
|
||||
|
||||
//-- initialize default-space
|
||||
defaultSpace = PRESERVE;
|
||||
@ -815,7 +828,9 @@ void ProcessorState::initialize() {
|
||||
setDefaultNameSpaceURI("");
|
||||
|
||||
//-- determine xsl properties
|
||||
Element* element = xslDocument->getDocumentElement();
|
||||
Element* element = NULL;
|
||||
if (xslDocument)
|
||||
element = xslDocument->getDocumentElement();
|
||||
if ( element ) {
|
||||
//-- process namespace nodes
|
||||
NamedNodeMap* atts = element->getAttributes();
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
* Keith Visco, kvisco@ziplink.net
|
||||
* -- original author.
|
||||
*
|
||||
* $Id: ProcessorState.h,v 1.7 2000-11-07 10:46:03 kvisco%ziplink.net Exp $
|
||||
* $Id: ProcessorState.h,v 1.8 2001-01-19 21:24:44 axel%pike.org Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
/**
|
||||
* Class used for keeping the current state of the XSL Processor
|
||||
* @author <a href="mailto:kvisco@ziplink.net">Keith Visco</a>
|
||||
* @version $Revision: 1.7 $ $Date: 2000-11-07 10:46:03 $
|
||||
* @version $Revision: 1.8 $ $Date: 2001-01-19 21:24:44 $
|
||||
**/
|
||||
class ProcessorState : public ContextState {
|
||||
|
||||
@ -60,6 +60,11 @@ public:
|
||||
static const String wrapperName;
|
||||
static const String wrapperNS;
|
||||
|
||||
/**
|
||||
* Creates a new ProcessorState
|
||||
**/
|
||||
ProcessorState();
|
||||
|
||||
/**
|
||||
* Creates a new ProcessorState for the given XSL document
|
||||
* And result Document
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user