You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/06/14 21:28:40 UTC
cvs commit: xml-xalan/c/src/XSLT StylesheetConstructionContextDefault.cpp StylesheetConstructionContextDefault.hpp StylesheetExecutionContext.hpp StylesheetExecutionContextDefault.cpp StylesheetExecutionContextDefault.hpp XSLTEngineImpl.cpp XSLTEngineImpl.hpp XSLTProcessor.hpp XSLTProcessorEnvSupport.hpp XSLTProcessorEnvSupportDefault.cpp XSLTProcessorEnvSupportDefault.hpp
dbertoni 01/06/14 12:28:40
Modified: c/src/XSLT StylesheetConstructionContextDefault.cpp
StylesheetConstructionContextDefault.hpp
StylesheetExecutionContext.hpp
StylesheetExecutionContextDefault.cpp
StylesheetExecutionContextDefault.hpp
XSLTEngineImpl.cpp XSLTEngineImpl.hpp
XSLTProcessor.hpp XSLTProcessorEnvSupport.hpp
XSLTProcessorEnvSupportDefault.cpp
XSLTProcessorEnvSupportDefault.hpp
Log:
Removed member function from XPathEnvSupport and its derivatives.
Revision Changes Path
1.16 +17 -6 xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp
Index: StylesheetConstructionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- StylesheetConstructionContextDefault.cpp 2001/04/30 18:12:52 1.15
+++ StylesheetConstructionContextDefault.cpp 2001/06/14 19:28:21 1.16
@@ -88,11 +88,10 @@
StylesheetConstructionContextDefault::StylesheetConstructionContextDefault(
XSLTEngineImpl& processor,
- XPathEnvSupport& xpathEnvSupport,
+ XPathEnvSupport& /* xpathEnvSupport */,
XPathFactory& xpathFactory) :
StylesheetConstructionContext(),
m_processor(processor),
- m_xpathEnvSupport(xpathEnvSupport),
m_xpathFactory(xpathFactory),
m_xpathProcessor(new XPathProcessorImpl),
m_stylesheets(),
@@ -102,6 +101,20 @@
+StylesheetConstructionContextDefault::StylesheetConstructionContextDefault(
+ XSLTEngineImpl& processor,
+ XPathFactory& xpathFactory) :
+ StylesheetConstructionContext(),
+ m_processor(processor),
+ m_xpathFactory(xpathFactory),
+ m_xpathProcessor(new XPathProcessorImpl),
+ m_stylesheets(),
+ m_tempBuffer()
+{
+}
+
+
+
StylesheetConstructionContextDefault::~StylesheetConstructionContextDefault()
{
reset();
@@ -331,8 +344,7 @@
m_xpathProcessor->initMatchPattern(*xpath,
str,
- resolver,
- m_xpathEnvSupport);
+ resolver);
xpath->setInStylesheet(true);
@@ -364,8 +376,7 @@
m_xpathProcessor->initXPath(*xpath,
str,
- resolver,
- m_xpathEnvSupport);
+ resolver);
xpath->setInStylesheet(true);
1.17 +18 -1 xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp
Index: StylesheetConstructionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetConstructionContextDefault.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- StylesheetConstructionContextDefault.hpp 2001/03/29 22:24:26 1.16
+++ StylesheetConstructionContextDefault.hpp 2001/06/14 19:28:22 1.17
@@ -110,6 +110,8 @@
* destroyed when the corresponding factories are destryed, leaving pointers to destroyed objects in the.
* stylesheet(s).
*
+ * @deprecated This constructor is deprecated.
+ *
* @param processor a reference to an XSLTEngineImpl instance. Used for error reporting.
* @param xpathEnvSupport a reference to an XPathEnvSupport instance.
* @param xpathFactory a reference to an XPathFactory instance. See comments above for important details.
@@ -120,6 +122,21 @@
XPathEnvSupport& xpathEnvSupport,
XPathFactory& xpathFactory);
+ /*
+ * Construct an instance. If the stylesheet(s) constructed is/are meant to be reused (a.k.a. "compiled"),
+ * the XObjectFactory and XPathFactory instance must exist for the lifetime of the construction context
+ * and, therefore, for the lifetime of the stylesheet(s). Otherwise, XObject and XPath instance will be
+ * destroyed when the corresponding factories are destryed, leaving pointers to destroyed objects in the.
+ * stylesheet(s).
+ *
+ * @param processor a reference to an XSLTEngineImpl instance. Used for error reporting.
+ * @param xpathFactory a reference to an XPathFactory instance. See comments above for important details.
+ *
+ */
+ StylesheetConstructionContextDefault(
+ XSLTEngineImpl& processor,
+ XPathFactory& xpathFactory);
+
virtual
~StylesheetConstructionContextDefault();
@@ -259,7 +276,7 @@
private:
XSLTEngineImpl& m_processor;
- XPathEnvSupport& m_xpathEnvSupport;
+
XPathFactory& m_xpathFactory;
typedef XalanAutoPtr<XPathProcessor> XPathProcessAutoPtr;
1.56 +0 -9 xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp
Index: StylesheetExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContext.hpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- StylesheetExecutionContext.hpp 2001/06/06 21:55:31 1.55
+++ StylesheetExecutionContext.hpp 2001/06/14 19:28:23 1.56
@@ -223,15 +223,6 @@
setCurrentMode(const QName* theMode) = 0;
/**
- * Reset the state of execution to node 'xmlNode' in source tree 'sourceTree.'
- *
- * @param xmlNode node to execute
- */
- virtual void
- resetCurrentState(
- XalanNode* xmlNode) = 0;
-
- /**
* Whether diagnostic output is to be generated
*
* @return true for diagnostics output
1.66 +8 -12 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp
Index: StylesheetExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- StylesheetExecutionContextDefault.cpp 2001/05/14 01:03:11 1.65
+++ StylesheetExecutionContextDefault.cpp 2001/06/14 19:28:24 1.66
@@ -272,15 +272,6 @@
-void
-StylesheetExecutionContextDefault::resetCurrentState(XalanNode* xmlNode)
-{
- assert(m_xsltProcessor != 0);
-
- m_xsltProcessor->resetCurrentState(xmlNode);
-}
-
-
bool
StylesheetExecutionContextDefault::doDiagnosticsOutput() const
{
@@ -935,8 +926,6 @@
theFormatter->setPrefixResolver(m_xsltProcessor);
- theResultTreeFrag->setOwnerDocument(theDocument);
-
StylesheetExecutionContext::OutputContextPushPop theOutputContextPushPop(
*this,
theFormatter);
@@ -1735,7 +1724,14 @@
bool
StylesheetExecutionContextDefault::shouldStripSourceNode(const XalanNode& node)
{
- return m_xpathExecutionContextDefault.shouldStripSourceNode(node);
+ if (m_xsltProcessor == 0)
+ {
+ return m_xpathExecutionContextDefault.shouldStripSourceNode(node);
+ }
+ else
+ {
+ return m_xsltProcessor->shouldStripSourceNode(*this, node);
+ }
}
1.60 +0 -4 xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp
Index: StylesheetExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/StylesheetExecutionContextDefault.hpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- StylesheetExecutionContextDefault.hpp 2001/05/14 01:03:12 1.59
+++ StylesheetExecutionContextDefault.hpp 2001/06/14 19:28:25 1.60
@@ -276,10 +276,6 @@
virtual void
setCurrentMode(const QName* theMode);
- virtual void
- resetCurrentState(
- XalanNode* xmlNode);
-
virtual bool
doDiagnosticsOutput() const;
1.101 +7 -112 xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp
Index: XSLTEngineImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- XSLTEngineImpl.cpp 2001/06/06 21:55:33 1.100
+++ XSLTEngineImpl.cpp 2001/06/14 19:28:26 1.101
@@ -180,7 +180,6 @@
m_domResultTreeFactory(0),
m_resultNameSpacePrefix(),
m_resultNameSpaceURL(),
- m_currentNode(),
m_xpathFactory(xpathFactory),
m_xobjectFactory(xobjectFactory),
m_xpathProcessor(new XPathProcessorImpl),
@@ -222,7 +221,6 @@
m_domResultTreeFactory = 0;
}
- m_currentNode = 0;
m_stylesheetRoot = 0;
m_outputContextStack.reset();
@@ -1676,7 +1674,7 @@
setFormatterListenerImpl(
m_executionContext->createFormatterToHTML(
- theFormatter->getWriter(),
+ *theFormatter->getWriter(),
theFormatter->getEncoding(),
theFormatter->getMediaType(),
theFormatter->getDoctypeSystem(),
@@ -2285,7 +2283,7 @@
{
const ResultTreeFragBase& docFrag = theTree.rtree(executionContext);
- const XalanNodeList* nl = docFrag.getChildNodes();
+ const XalanNodeList* const nl = docFrag.getChildNodes();
assert(nl != 0);
const unsigned int nChildren = nl->getLength();
@@ -2542,6 +2540,8 @@
const XalanDOMString& str,
XPathExecutionContext& executionContext)
{
+ assert(executionContext.getPrefixResolver() != 0);
+
XPath* const theXPath = m_xpathFactory.create();
XPathGuard theGuard(m_xpathFactory,
@@ -2549,8 +2549,7 @@
m_xpathProcessor->initXPath(*theXPath,
str,
- *executionContext.getPrefixResolver(),
- m_xpathEnvSupport);
+ *executionContext.getPrefixResolver());
return theXPath->execute(executionContext.getCurrentNode(),
*executionContext.getPrefixResolver(),
@@ -2573,8 +2572,7 @@
m_xpathProcessor->initXPath(*theXPath,
str,
- prefixResolver,
- m_xpathEnvSupport);
+ prefixResolver);
return theXPath->execute(contextNode, prefixResolver, executionContext);
}
@@ -2608,7 +2606,7 @@
{
XPath* const xpath = m_xpathFactory.create();
- m_xpathProcessor->initMatchPattern(*xpath, str, resolver, m_xpathEnvSupport);
+ m_xpathProcessor->initMatchPattern(*xpath, str, resolver);
return xpath;
}
@@ -2892,109 +2890,6 @@
XSLTEngineImpl::resolveTopLevelParams(StylesheetExecutionContext& executionContext)
{
executionContext.pushTopLevelVariables(m_topLevelParams);
-}
-
-
-
-void
-XSLTEngineImpl::resetCurrentState(XalanNode* xmlNode)
-{
- if(0 != xmlNode)
- {
- //===============================================
- // This will be used with callbacks from script,
- // in places like getAttributeCallback.
- m_currentNode = xmlNode;
- }
-}
-
-
-
-// $$$ ToDo: This really belongs in DOMServices or DOMSupport()
-XalanElement*
-XSLTEngineImpl::findElementByAttribute(
- XalanElement& elem,
- const XalanDOMString& targetElementName,
- const XalanDOMString& targetAttributeName,
- const XalanDOMString& targetAttributeValue)
-{
- XalanElement* theFoundElement = 0;
-
- const XalanDOMString tagName = elem.getTagName();
-
- if(0 == length(targetElementName) || equals(tagName, targetElementName))
- {
- const XalanNamedNodeMap* const attributes = elem.getAttributes();
-
- try
- {
- const unsigned int nAttributes = 0 != attributes ? attributes->getLength() : 0;
-
- for(unsigned int i = 0; i < nAttributes; i++)
- {
- const XalanAttr* const attr =
-#if defined(XALAN_OLD_STYLE_CASTS)
- (const XalanAttr*)attributes->item(i);
-#else
- static_cast<const XalanAttr*>(attributes->item(i));
-#endif
-
- const XalanDOMString& attrName = attr->getName();
-
- if(equals(attrName, targetAttributeName))
- {
- const XalanDOMString& attrVal = attr->getValue();
-
- if(equals(attrVal, targetAttributeValue))
- {
- theFoundElement = &elem;
- break;
- }
- }
- }
- }
- catch(const XalanDOMException&)
- {
- }
- }
-
- if(0 == theFoundElement)
- {
- XalanNode* childNode = elem.getFirstChild();
-
- while(childNode != 0)
- {
- if (childNode->getNodeType() == XalanNode::ELEMENT_NODE)
- {
- XalanElement* child =
-#if defined(XALAN_OLD_STYLE_CASTS)
- (XalanElement*)childNode;
-#else
- static_cast<XalanElement*>(childNode);
-#endif
-
- const XalanDOMString& childName = child->getTagName();
-
- if(0 != length(childName))
- {
- theFoundElement = findElementByAttribute(
- *child,
- targetElementName,
- targetAttributeName,
- targetAttributeValue);
-
- if(0 != theFoundElement)
- {
- break;
- }
- }
- }
-
- childNode = childNode->getNextSibling();
- }
- }
-
- return theFoundElement;
}
1.68 +0 -30 xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp
Index: XSLTEngineImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTEngineImpl.hpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- XSLTEngineImpl.hpp 2001/05/14 01:03:12 1.67
+++ XSLTEngineImpl.hpp 2001/06/14 19:28:27 1.68
@@ -257,9 +257,6 @@
const XObject& xobj);
virtual void
- resetCurrentState(XalanNode* xmlNode);
-
- virtual void
resolveTopLevelParams(StylesheetExecutionContext& executionContext);
virtual XMLParserLiaison&
@@ -1480,24 +1477,7 @@
XalanDOMString m_resultNameSpaceURL;
- /*
- * The current input element that is being processed.
- */
- XalanNode* m_currentNode;
-
/**
- * Given a tag name, an attribute name, and
- * an attribute value, do a very crude recursive
- * search and locate the first match.
- */
- static XalanElement*
- findElementByAttribute(
- XalanElement& elem,
- const XalanDOMString& targetElementName,
- const XalanDOMString& targetAttributeName,
- const XalanDOMString& targetAttributeValue);
-
- /**
* Copy the attributes from the XSL element to the created
* output element, executing attribute templates and
* processing the xsl:use attribute as need be.
@@ -1674,16 +1654,6 @@
clearTopLevelParams()
{
m_topLevelParams.clear();
- }
-
- /**
- * Returns the current input node that is being
- * processed.
- */
- XalanNode*
- getSourceNode() const
- {
- return m_currentNode;
}
private:
1.22 +0 -10 xml-xalan/c/src/XSLT/XSLTProcessor.hpp
Index: XSLTProcessor.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessor.hpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XSLTProcessor.hpp 2001/03/29 22:24:27 1.21
+++ XSLTProcessor.hpp 2001/06/14 19:28:28 1.22
@@ -219,16 +219,6 @@
const XObject& xobj) = 0;
/**
- * Reset the state of execution to node 'xmlNode' in source tree
- * 'sourceTree.'
- *
- * @param xmlNode node to execute
- */
- virtual void
- resetCurrentState(
- XalanNode* xmlNode) = 0;
-
- /**
* Retrieve the root stylesheet.
*
* @return pointer to root stylesheet
1.10 +0 -5 xml-xalan/c/src/XSLT/XSLTProcessorEnvSupport.hpp
Index: XSLTProcessorEnvSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupport.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XSLTProcessorEnvSupport.hpp 2001/03/29 22:24:27 1.9
+++ XSLTProcessorEnvSupport.hpp 2001/06/14 19:28:29 1.10
@@ -125,11 +125,6 @@
const XObjectArgVectorType& argVec) const = 0;
virtual bool
- shouldStripSourceNode(
- XPathExecutionContext& executionContext,
- const XalanNode& node) const = 0;
-
- virtual bool
problem(
eSource where,
eClassification classification,
1.22 +0 -17 xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp
Index: XSLTProcessorEnvSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XSLTProcessorEnvSupportDefault.cpp 2001/04/30 18:12:59 1.21
+++ XSLTProcessorEnvSupportDefault.cpp 2001/06/14 19:28:30 1.22
@@ -290,23 +290,6 @@
bool
-XSLTProcessorEnvSupportDefault::shouldStripSourceNode(
- XPathExecutionContext& executionContext,
- const XalanNode& node) const
-{
- if (m_processor == 0)
- {
- return m_defaultSupport.shouldStripSourceNode(executionContext, node);
- }
- else
- {
- return m_processor->shouldStripSourceNode(executionContext, node);
- }
-}
-
-
-
-bool
XSLTProcessorEnvSupportDefault::problem(
eSource /* where */,
eClassification classification,
1.17 +0 -5 xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.hpp
Index: XSLTProcessorEnvSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/XSLTProcessorEnvSupportDefault.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XSLTProcessorEnvSupportDefault.hpp 2001/03/29 22:24:27 1.16
+++ XSLTProcessorEnvSupportDefault.hpp 2001/06/14 19:28:31 1.17
@@ -190,11 +190,6 @@
const XObjectArgVectorType& argVec) const;
virtual bool
- shouldStripSourceNode(
- XPathExecutionContext& executionContext,
- const XalanNode& node) const;
-
- virtual bool
problem(
eSource where,
eClassification classification,
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org