dbertoni 00/04/11 07:47:01
Modified: c/src/XPath ElementPrefixResolverProxy.cpp
ElementPrefixResolverProxy.hpp Function.hpp
FunctionBoolean.hpp FunctionCeiling.hpp
FunctionConcat.hpp FunctionContains.hpp
FunctionCount.hpp FunctionDefaultStringArgument.hpp
FunctionFalse.hpp FunctionFloor.hpp FunctionID.hpp
FunctionLang.hpp FunctionLast.hpp
FunctionLocalName.hpp FunctionName.hpp
FunctionNamespaceURI.hpp FunctionNormalize.hpp
FunctionNot.hpp FunctionNumber.hpp
FunctionPosition.hpp FunctionRound.hpp
FunctionStartsWith.hpp FunctionString.hpp
FunctionStringLength.hpp FunctionSubstring.hpp
FunctionSubstringAfter.hpp
FunctionSubstringBefore.hpp FunctionSum.hpp
FunctionTranslate.hpp FunctionTrue.hpp
MutableNodeRefList.cpp MutableNodeRefList.hpp
NameSpace.hpp NodeListImplSurrogate.cpp
NodeListImplSurrogate.hpp NodeRefList.cpp
NodeRefList.hpp NodeRefListBase.cpp
NodeRefListBase.hpp PrefixResolver.hpp QName.cpp
QName.hpp ResultTreeFrag.cpp ResultTreeFrag.hpp
ResultTreeFragBase.cpp ResultTreeFragBase.hpp
SimpleNodeLocator.cpp SimpleNodeLocator.hpp
XBoolean.cpp XBoolean.hpp XBooleanStatic.cpp
XBooleanStatic.hpp XLocator.hpp XNodeSet.cpp
XNodeSet.hpp XNull.cpp XNull.hpp XNumber.cpp
XNumber.hpp XObject.cpp XObject.hpp
XObjectFactory.hpp XObjectFactoryDefault.cpp
XObjectFactoryDefault.hpp XObjectTypeCallback.hpp
XPath.cpp XPath.hpp XPathEnvSupport.hpp
XPathEnvSupportDefault.cpp
XPathEnvSupportDefault.hpp XPathException.cpp
XPathException.hpp XPathExecutionContext.hpp
XPathExecutionContextDefault.cpp
XPathExecutionContextDefault.hpp
XPathExpression.cpp XPathExpression.hpp
XPathFactory.hpp XPathFactoryDefault.cpp
XPathFactoryDefault.hpp XPathFunctionTable.cpp
XPathFunctionTable.hpp XPathParserException.cpp
XPathParserException.hpp XPathProcessor.cpp
XPathProcessor.hpp XPathProcessorImpl.cpp
XPathProcessorImpl.hpp XPathSupport.hpp
XPathSupportDefault.cpp XPathSupportDefault.hpp
XPointer.cpp XPointer.hpp XResultTreeFrag.cpp
XResultTreeFrag.hpp XSpan.cpp XSpan.hpp XString.cpp
XString.hpp XUnknown.cpp XUnknown.hpp
Log:
Changes for new Xalan DOM.
Revision Changes Path
1.3 +24 -6 xml-xalan/c/src/XPath/ElementPrefixResolverProxy.cpp
Index: ElementPrefixResolverProxy.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ElementPrefixResolverProxy.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElementPrefixResolverProxy.cpp 2000/02/17 20:29:50 1.2
+++ ElementPrefixResolverProxy.cpp 2000/04/11 14:46:03 1.3
@@ -59,13 +59,17 @@
+#include <XalanDOM/XalanElement.hpp>
+
+
+
#include "XPathEnvSupport.hpp"
#include "XPathSupport.hpp"
ElementPrefixResolverProxy::ElementPrefixResolverProxy(
- const DOM_Element& namespaceContext,
+ const XalanElement* namespaceContext,
const XPathEnvSupport& envSupport,
const XPathSupport& support) :
m_namespaceContext(namespaceContext),
@@ -82,16 +86,30 @@
-DOMString
-ElementPrefixResolverProxy::getNamespaceForPrefix(const DOMString& prefix)
const
+XalanDOMString
+ElementPrefixResolverProxy::getNamespaceForPrefix(const XalanDOMString&
prefix) const
{
- return m_support.getNamespaceForPrefix(prefix, m_namespaceContext);
+ if (m_namespaceContext == 0)
+ {
+ return XalanDOMString();
+ }
+ else
+ {
+ return m_support.getNamespaceForPrefix(prefix,
*m_namespaceContext);
+ }
}
-DOMString
+XalanDOMString
ElementPrefixResolverProxy::getURI() const
{
- return
m_envSupport.findURIFromDoc(m_namespaceContext.getOwnerDocument());
+ if (m_namespaceContext == 0)
+ {
+ return XalanDOMString();
+ }
+ else
+ {
+ return
m_envSupport.findURIFromDoc(m_namespaceContext->getOwnerDocument());
+ }
}
1.4 +8 -12 xml-xalan/c/src/XPath/ElementPrefixResolverProxy.hpp
Index: ElementPrefixResolverProxy.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ElementPrefixResolverProxy.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElementPrefixResolverProxy.hpp 2000/03/03 19:00:12 1.3
+++ ElementPrefixResolverProxy.hpp 2000/04/11 14:46:03 1.4
@@ -64,11 +64,6 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Element.hpp>
-
-
-
// Base class header file...
#include <XPath/PrefixResolver.hpp>
@@ -76,6 +71,7 @@
class XPathEnvSupport;
class XPathSupport;
+class XalanElement;
@@ -91,7 +87,7 @@
* @param support XPath support class instance
*/
ElementPrefixResolverProxy(
- const DOM_Element& namespaceContext,
+ const XalanElement* namespaceContext,
const XPathEnvSupport& envSupport,
const XPathSupport& support);
@@ -100,17 +96,17 @@
// These methods are inherited from PrefixResolver ...
- virtual DOMString
- getNamespaceForPrefix(const DOMString& prefix) const;
+ virtual XalanDOMString
+ getNamespaceForPrefix(const XalanDOMString& prefix) const;
- virtual DOMString
+ virtual XalanDOMString
getURI() const;
private:
- const DOM_Element m_namespaceContext;
- const XPathEnvSupport& m_envSupport;
- const XPathSupport& m_support;
+ const XalanElement* const m_namespaceContext;
+ const XPathEnvSupport& m_envSupport;
+ const XPathSupport& m_support;
};
1.4 +2 -2 xml-xalan/c/src/XPath/Function.hpp
Index: Function.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/Function.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Function.hpp 2000/03/03 19:00:13 1.3
+++ Function.hpp 2000/04/11 14:46:04 1.4
@@ -68,7 +68,7 @@
-class DOM_Node;
+class XalanNode;
class XObject;
class XPathExecutionContext;
@@ -107,7 +107,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
opPos,
const XObjectArgVectorType& args) = 0;
1.4 +1 -1 xml-xalan/c/src/XPath/FunctionBoolean.hpp
Index: FunctionBoolean.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionBoolean.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionBoolean.hpp 2000/03/03 19:00:13 1.3
+++ FunctionBoolean.hpp 2000/04/11 14:46:04 1.4
@@ -95,7 +95,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.4 +1 -2 xml-xalan/c/src/XPath/FunctionCeiling.hpp
Index: FunctionCeiling.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionCeiling.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionCeiling.hpp 2000/03/03 19:00:13 1.3
+++ FunctionCeiling.hpp 2000/04/11 14:46:04 1.4
@@ -74,7 +74,6 @@
-#include <XPath/XObject.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathExecutionContext.hpp>
@@ -96,7 +95,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.4 +2 -2 xml-xalan/c/src/XPath/FunctionConcat.hpp
Index: FunctionConcat.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionConcat.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionConcat.hpp 2000/03/03 19:00:13 1.3
+++ FunctionConcat.hpp 2000/04/11 14:46:04 1.4
@@ -99,7 +99,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -111,7 +111,7 @@
context);
}
- DOMString theResult;
+ XalanDOMString theResult;
for(XObjectArgVectorType::size_type i = 0; i < theArgCount; i++)
{
1.4 +5 -5 xml-xalan/c/src/XPath/FunctionContains.hpp
Index: FunctionContains.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionContains.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionContains.hpp 2000/03/03 19:00:13 1.3
+++ FunctionContains.hpp 2000/04/11 14:46:04 1.4
@@ -99,7 +99,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -109,12 +109,12 @@
context);
}
- const DOMString arg1 = args[0]->str();
- const DOMString arg2 = args[1]->str();
+ const XalanDOMString arg1 = args[0]->str();
+ const XalanDOMString arg2 = args[1]->str();
- const int theIndex = indexOf(arg1, arg2);
+ const unsigned int theIndex = indexOf(arg1, arg2);
- return
executionContext.getXObjectFactory().createBoolean(theIndex >= 0 ? true :
false);
+ return
executionContext.getXObjectFactory().createBoolean(theIndex < length(arg1) ?
true : false);
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
1.4 +1 -1 xml-xalan/c/src/XPath/FunctionCount.hpp
Index: FunctionCount.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionCount.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionCount.hpp 2000/03/03 19:00:13 1.3
+++ FunctionCount.hpp 2000/04/11 14:46:05 1.4
@@ -96,7 +96,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.4 +4 -4 xml-xalan/c/src/XPath/FunctionDefaultStringArgument.hpp
Index: FunctionDefaultStringArgument.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionDefaultStringArgument.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionDefaultStringArgument.hpp 2000/03/03 19:00:13 1.3
+++ FunctionDefaultStringArgument.hpp 2000/04/11 14:46:05 1.4
@@ -102,7 +102,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
opPos,
const XObjectArgVectorType& args) = 0;
@@ -113,10 +113,10 @@
protected:
- virtual DOMString
+ virtual XalanDOMString
getDefaultStringArgument(
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode& context,
int
opPos)
{
// This is complicated. The XPath standard says that if there
@@ -144,7 +144,7 @@
// Get the result...
FactoryObjectAutoPointer<XObject>
theXString(&executionContext.getXObjectFactory(),
theStringFunctor.execute(executionContext,
-
context,
+
&context,
opPos,
theNewArgs));
1.4 +1 -2 xml-xalan/c/src/XPath/FunctionFalse.hpp
Index: FunctionFalse.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionFalse.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionFalse.hpp 2000/03/03 19:00:14 1.3
+++ FunctionFalse.hpp 2000/04/11 14:46:05 1.4
@@ -73,7 +73,6 @@
-#include <XPath/XObject.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathExecutionContext.hpp>
@@ -95,7 +94,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.4 +1 -1 xml-xalan/c/src/XPath/FunctionFloor.hpp
Index: FunctionFloor.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionFloor.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionFloor.hpp 2000/03/03 19:00:14 1.3
+++ FunctionFloor.hpp 2000/04/11 14:46:05 1.4
@@ -96,7 +96,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.5 +25 -22 xml-xalan/c/src/XPath/FunctionID.hpp
Index: FunctionID.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionID.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FunctionID.hpp 2000/03/03 19:00:14 1.4
+++ FunctionID.hpp 2000/04/11 14:46:05 1.5
@@ -68,8 +68,9 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Document.hpp>
+#include <XalanDOM/XalanElement.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanDocument.hpp>
@@ -79,10 +80,6 @@
-#include <Include/DOMHelper.hpp>
-
-
-
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/StringTokenizer.hpp>
@@ -119,7 +116,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -128,19 +125,25 @@
executionContext.error("The id() function takes one
argument!",
context);
}
+ else if (context == 0)
+ {
+ executionContext.error("The id() function requires a
non-null context node!",
+ context);
+ }
// OK, reset the data members...
m_executionContext = &executionContext;
- m_resultString = 0;
+ clear(m_resultString);
// Do the callback to get the data.
args[0]->ProcessXObjectTypeCallback(*this);
// Get the context document, so we can search for nodes.
- DOM_Document theDocContext = context.getNodeType()
== DOM_Node::DOCUMENT_NODE ?
-
reinterpret_cast<const DOM_Document&>(context) :
-
context.getOwnerDocument();
+ const XalanDocument* const theDocContext =
context->getNodeType() == XalanNode::DOCUMENT_NODE ?
+
reinterpret_cast<const XalanDocument*>(context) :
+
context->getOwnerDocument();
+ assert(theDocContext != 0);
// This list will hold the nodes we find.
MutableNodeRefList
theNodeList(executionContext.createMutableNodeRefList());
@@ -157,7 +160,7 @@
using std::set;
#endif
- typedef set<DOMString> TokenSetType;
+ typedef set<XalanDOMString> TokenSetType;
// This set will hold tokens that we've previously
found, so
// we can avoid looking more than once.
@@ -168,7 +171,7 @@
// Parse the result string...
while(theTokenizer.hasMoreTokens() == true)
{
- const DOMString theToken =
theTokenizer.nextToken();
+ const XalanDOMString theToken =
theTokenizer.nextToken();
if (length(theToken) > 0)
{
@@ -180,8 +183,8 @@
{
thePreviousTokens.insert(theToken);
- const DOM_Node theNode =
-
executionContext.getElementByID(theToken, theDocContext);
+ XalanNode* const theNode
=
+
executionContext.getElementByID(theToken, *theDocContext);
if (theNode != 0)
{
@@ -223,8 +226,8 @@
}
virtual void
- String(const XObject& theXObject,
- const DOMString& /* theValue */)
+ String(const XObject& theXObject,
+ const XalanDOMString& /* theValue */)
{
m_resultString = theXObject.str();
}
@@ -253,15 +256,15 @@
for (unsigned int i = 0 ; i < theNodeCount; i++)
{
- m_resultString +=
m_executionContext->getNodeData(theValue.item(i));
+ m_resultString +=
m_executionContext->getNodeData(*theValue.item(i));
m_resultString += " ";
}
}
virtual void
- Unknown(const XObject& /* theObject */,
- const DOMString& /* theName */)
+ Unknown(const XObject& /* theObject */,
+ const XalanDOMString& /* theName */)
{
}
@@ -281,9 +284,9 @@
// Data members...
- XPathExecutionContext* m_executionContext;
+ XPathExecutionContext* m_executionContext;
- DOMString m_resultString;
+ XalanDOMString m_resultString;
};
1.4 +12 -10 xml-xalan/c/src/XPath/FunctionLang.hpp
Index: FunctionLang.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionLang.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionLang.hpp 2000/03/03 19:00:14 1.3
+++ FunctionLang.hpp 2000/04/11 14:46:06 1.4
@@ -68,7 +68,8 @@
-#include <Include/DOMHelper.hpp>
+#include <XalanDOM/XalanElement.hpp>
+#include <XalanDOM/XalanNode.hpp>
@@ -103,7 +104,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -113,20 +114,21 @@
context);
}
- DOM_Node parent = context;
+ const XalanNode* parent = context;
- bool fMatch = false;
+ bool fMatch = false;
- const DOMString lang(args[0]->str());
+ const XalanDOMString lang(args[0]->str());
while(0 != parent)
{
- if(DOM_Node::ELEMENT_NODE == parent.getNodeType())
+ if(XalanNode::ELEMENT_NODE == parent->getNodeType())
{
- const DOM_Element& theElementNode =
- reinterpret_cast<const
DOM_Element&>(parent);
+ const XalanElement* const theElementNode =
+ static_cast<const
XalanElement*>(parent);
- const DOMString langVal =
theElementNode.getAttribute("xml:lang");
+ const XalanDOMString langVal =
+
theElementNode->getAttribute("xml:lang");
if(0 != length(langVal))
{
@@ -145,7 +147,7 @@
}
}
- parent = executionContext.getParentOfNode(parent);
+ parent = executionContext.getParentOfNode(*parent);
}
return
executionContext.getXObjectFactory().createBoolean(fMatch);
1.4 +2 -2 xml-xalan/c/src/XPath/FunctionLast.hpp
Index: FunctionLast.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionLast.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionLast.hpp 2000/03/03 19:00:14 1.3
+++ FunctionLast.hpp 2000/04/11 14:46:06 1.4
@@ -95,7 +95,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -105,7 +105,7 @@
context);
}
- const int theValue =
executionContext.getContextNodeListLength();
+ const unsigned int theValue =
executionContext.getContextNodeListLength();
return
executionContext.getXObjectFactory().createNumber(theValue);
}
1.4 +3 -3 xml-xalan/c/src/XPath/FunctionLocalName.hpp
Index: FunctionLocalName.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionLocalName.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionLocalName.hpp 2000/03/03 19:00:14 1.3
+++ FunctionLocalName.hpp 2000/04/11 14:46:06 1.4
@@ -100,7 +100,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -112,11 +112,11 @@
const NodeRefListBase& theNodeList = args[0]->nodeset();
- DOMString theData;
+ XalanDOMString theData;
if (theNodeList.getLength() > 0)
{
- theData =
executionContext.getLocalNameOfNode(theNodeList.item(0));
+ theData =
executionContext.getLocalNameOfNode(*theNodeList.item(0));
}
return
executionContext.getXObjectFactory().createString(theData);
1.4 +27 -23 xml-xalan/c/src/XPath/FunctionName.hpp
Index: FunctionName.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionName.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionName.hpp 2000/03/03 19:00:15 1.3
+++ FunctionName.hpp 2000/04/11 14:46:06 1.4
@@ -68,16 +68,12 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Attr.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanAttr.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
-#include <Include/DOMHelper.hpp>
-
-
-
// Base class header file...
#include <XPath/Function.hpp>
@@ -106,24 +102,32 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
const XObjectArgVectorType::size_type theSize = args.size();
- DOMString
theResult;
+ XalanDOMString
theResult;
if(theSize == 0)
{
- // Make a temporary XObject from the context node.
- XObjectFactory&
theFactory =
-
executionContext.getXObjectFactory();
+ if (context == 0)
+ {
+ executionContext.error("The name() function
requires a non-null context node!",
+
context);
+ }
+ else
+ {
+ // Make a temporary XObject from the context
node.
+ XObjectFactory&
theFactory =
+
executionContext.getXObjectFactory();
- FactoryObjectAutoPointer<XObject>
theXObject(&theFactory,
-
theFactory.createNodeSet(context));
+ FactoryObjectAutoPointer<XObject>
theXObject(&theFactory,
+
theFactory.createNodeSet(*context));
- theResult = getNameFromNodeList(theXObject->nodeset());
+ theResult =
getNameFromNodeList(theXObject->nodeset());
+ }
}
else if (theSize == 1)
{
@@ -156,26 +160,26 @@
* @param theNodeList node list
* @return name string of node, or an empty string if node list is empty
*/
- virtual DOMString
+ virtual XalanDOMString
getNameFromNodeList(const NodeRefListBase& theNodeList) const
{
- DOMString theResult;
+ XalanDOMString theResult;
if (theNodeList.getLength() > 0)
{
- DOM_Node theNode = theNodeList.item(0);
+ const XalanNode* const theNode = theNodeList.item(0);
assert(theNode != 0);
- if (DOM_Node::ATTRIBUTE_NODE == theNode.getNodeType())
+ if (XalanNode::ATTRIBUTE_NODE == theNode->getNodeType())
{
- const DOM_Attr& theAttributeNode =
- reinterpret_cast<const
DOM_Attr&>(theNode);
+ const XalanAttr* const theAttributeNode =
+ reinterpret_cast<const
XalanAttr*>(theNode);
- theResult = theAttributeNode.getName();
+ theResult = theAttributeNode->getName();
}
else
{
- theResult = theNode.getNodeName();
+ theResult = theNode->getNodeName();
}
}
1.4 +11 -6 xml-xalan/c/src/XPath/FunctionNamespaceURI.hpp
Index: FunctionNamespaceURI.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionNamespaceURI.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionNamespaceURI.hpp 2000/03/03 19:00:15 1.3
+++ FunctionNamespaceURI.hpp 2000/04/11 14:46:06 1.4
@@ -96,11 +96,11 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
- DOMString theNamespace;
+ XalanDOMString theNamespace;
if (args.size() > 1)
{
@@ -112,6 +112,11 @@
theNamespace = getNamespaceFromNodeSet(*args[0],
executionContext);
}
+ else if (context == 0)
+ {
+ executionContext.error("The namespace-uri() function
requires a non-null context node!",
+ context);
+ }
else
{
// The XPath standard says that if there are no
arguments,
@@ -125,7 +130,7 @@
// An XObject that contains the context node.
FactoryObjectAutoPointer<XObject>
theXObject(&executionContext.getXObjectFactory(),
-
executionContext.getXObjectFactory().createNodeSet(context));
+
executionContext.getXObjectFactory().createNodeSet(*context));
theNamespace =
getNamespaceFromNodeSet(*theXObject.get(),
@@ -143,17 +148,17 @@
private:
- static DOMString
+ static XalanDOMString
getNamespaceFromNodeSet(const XObject& theXObject,
XPathExecutionContext&
theContext)
{
- DOMString theNamespace;
+ XalanDOMString theNamespace;
const NodeRefListBase& theList = theXObject.nodeset();
if (theList.getLength() > 0)
{
- theNamespace =
theContext.getNamespaceOfNode(theList.item(0));
+ theNamespace =
theContext.getNamespaceOfNode(*theList.item(0));
}
return theNamespace;
1.4 +15 -10 xml-xalan/c/src/XPath/FunctionNormalize.hpp
Index: FunctionNormalize.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionNormalize.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionNormalize.hpp 2000/03/03 19:00:15 1.3
+++ FunctionNormalize.hpp 2000/04/11 14:46:07 1.4
@@ -94,11 +94,11 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
opPos,
const XObjectArgVectorType& args)
{
- DOMString theSourceString;
+ XalanDOMString theSourceString;
if(args.size() > 2)
{
@@ -109,16 +109,21 @@
{
theSourceString = args[0]->str();
}
+ else if (context == 0)
+ {
+ executionContext.error("The normalize-space() function
requires a non-null context node!",
+ context);
+ }
else
{
theSourceString =
getDefaultStringArgument(executionContext,
-
context,
+
*context,
opPos);
}
- const int theSourceStringLength =
length(theSourceString);
+ const unsigned int theSourceStringLength =
length(theSourceString);
- XMLCh thePreviousChar = 0;
+ XalanDOMChar thePreviousChar = 0;
// A vector to contain the new characters. We'll use it to
construct
// the result string.
@@ -126,7 +131,7 @@
using std::vector;
#endif
- vector<XMLCh> theVector;
+ vector<XalanDOMChar> theVector;
// The result string can only be as large as the source string,
so
// just reserve the space now. Also reserve a space for the
@@ -134,9 +139,9 @@
theVector.reserve(theSourceStringLength + 1);
// OK, strip out any multiple spaces...
- for (int i = 0; i < theSourceStringLength; i++)
+ for (unsigned int i = 0; i < theSourceStringLength; i++)
{
- const XMLCh theCurrentChar =
charAt(theSourceString, i);
+ const XalanDOMChar theCurrentChar =
charAt(theSourceString, i);
if (isSpace(theCurrentChar) == true)
{
@@ -145,7 +150,7 @@
// space.
if (isSpace(thePreviousChar) == false &&
theVector.size() > 0)
{
- theVector.push_back(XMLCh(' '));
+ theVector.push_back(XalanDOMChar(' '));
}
}
else
@@ -162,7 +167,7 @@
theVector.pop_back();
}
- return
executionContext.getXObjectFactory().createString(DOMString(theVector.begin(),
theVector.size()));
+ return
executionContext.getXObjectFactory().createString(XalanDOMString(theVector.begin(),
theVector.size()));
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
1.4 +1 -1 xml-xalan/c/src/XPath/FunctionNot.hpp
Index: FunctionNot.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionNot.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionNot.hpp 2000/03/03 19:00:15 1.3
+++ FunctionNot.hpp 2000/04/11 14:46:07 1.4
@@ -99,7 +99,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.4 +7 -2 xml-xalan/c/src/XPath/FunctionNumber.hpp
Index: FunctionNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionNumber.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionNumber.hpp 2000/03/03 19:00:15 1.3
+++ FunctionNumber.hpp 2000/04/11 14:46:07 1.4
@@ -95,7 +95,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -110,6 +110,11 @@
{
theValue = args[0]->num();
}
+ else if (context == 0)
+ {
+ executionContext.error("The number() function requires
a non-null context node!",
+ context);
+ }
else
{
// The XPath standard says that if there are no
arguments,
@@ -122,7 +127,7 @@
// An XObject that contains the context node.
FactoryObjectAutoPointer<XObject>
theXObject(&executionContext.getXObjectFactory(),
-
executionContext.getXObjectFactory().createNodeSet(context));
+
executionContext.getXObjectFactory().createNodeSet(*context));
// Get the numeric value of the theXObject...
theValue = theXObject->num();
1.4 +7 -2 xml-xalan/c/src/XPath/FunctionPosition.hpp
Index: FunctionPosition.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionPosition.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionPosition.hpp 2000/03/03 19:00:16 1.3
+++ FunctionPosition.hpp 2000/04/11 14:46:07 1.4
@@ -95,7 +95,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -104,8 +104,13 @@
executionContext.error("The position() function takes
no arguments!",
context);
}
+ else if (context == 0)
+ {
+ executionContext.error("The position() function
requires a non-null context node!",
+ context);
+ }
- const int theValue =
executionContext.getContextNodeListPosition(context);
+ const unsigned int theValue =
executionContext.getContextNodeListPosition(*context);
return
executionContext.getXObjectFactory().createNumber(theValue);
}
1.4 +1 -1 xml-xalan/c/src/XPath/FunctionRound.hpp
Index: FunctionRound.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionRound.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionRound.hpp 2000/03/03 19:00:16 1.3
+++ FunctionRound.hpp 2000/04/11 14:46:07 1.4
@@ -96,7 +96,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.4 +2 -2 xml-xalan/c/src/XPath/FunctionStartsWith.hpp
Index: FunctionStartsWith.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionStartsWith.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionStartsWith.hpp 2000/03/03 19:00:16 1.3
+++ FunctionStartsWith.hpp 2000/04/11 14:46:08 1.4
@@ -99,13 +99,13 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
if(args.size() != 2)
{
- executionContext.error("The startswith() function takes
one argument!",
+ executionContext.error("The starts-with() function
takes one argument!",
context);
}
1.4 +1 -1 xml-xalan/c/src/XPath/FunctionString.hpp
Index: FunctionString.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionString.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionString.hpp 2000/03/03 19:00:16 1.3
+++ FunctionString.hpp 2000/04/11 14:46:08 1.4
@@ -99,7 +99,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.4 +13 -5 xml-xalan/c/src/XPath/FunctionStringLength.hpp
Index: FunctionStringLength.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionStringLength.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionStringLength.hpp 2000/03/03 19:00:16 1.3
+++ FunctionStringLength.hpp 2000/04/11 14:46:08 1.4
@@ -96,19 +96,27 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
opPos,
const XObjectArgVectorType& args)
{
const XObjectArgVectorType::size_type theSize = args.size();
- DOMString theResult;
+ XalanDOMString theResult;
if(theSize == 0)
{
- theResult = getDefaultStringArgument(executionContext,
-
context,
-
opPos);
+ if (context == 0)
+ {
+ executionContext.error("The string-length()
function requires a non-null context node!",
+
context);
+ }
+ else
+ {
+ theResult =
getDefaultStringArgument(executionContext,
+
*context,
+
opPos);
+ }
}
else if (theSize == 1)
{
1.4 +8 -8 xml-xalan/c/src/XPath/FunctionSubstring.hpp
Index: FunctionSubstring.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstring.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionSubstring.hpp 2000/03/03 19:00:16 1.3
+++ FunctionSubstring.hpp 2000/04/11 14:46:08 1.4
@@ -99,7 +99,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -112,15 +112,15 @@
context);
}
- const DOMString theSourceString = args[0]->str();
- const int theSourceStringLength =
length(theSourceString);
+ const XalanDOMString theSourceString = args[0]->str();
+ const unsigned int theSourceStringLength =
length(theSourceString);
#if !defined(XALAN_NO_NAMESPACES)
using std::vector;
#endif
// This buffer will hold the output characters.
- vector<XMLCh> theBuffer;
+ vector<XalanDOMChar> theBuffer;
if (theSourceStringLength > 0)
{
@@ -132,17 +132,17 @@
// $$$ ToDo: Add support for NaN.
// Get the value of the second argument...
- const double theSecondArgValue =
args[1]->num();
+ const double theSecondArgValue = args[1]->num();
// Now, total the second and third arguments. If
// the third argument is missing, make the total
// DBL_MAX.
- const double theTotal =
+ const double theTotal =
theArgCount == 2 ?
DBL_MAX :
theSecondArgValue + args[2]->num();
// Start with 1, since strings are index from 1 in the
XPath spec,
- for (int i = 1; i <= theSourceStringLength; i++)
+ for (unsigned int i = 1; i <= theSourceStringLength;
i++)
{
// Is the index greater than or equal to the
second argument?
if (i >= theSecondArgValue)
@@ -163,7 +163,7 @@
}
}
- return
executionContext.getXObjectFactory().createString(DOMString(theBuffer.begin(),
theBuffer.size()));
+ return
executionContext.getXObjectFactory().createString(XalanDOMString(theBuffer.begin(),
theBuffer.size()));
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
1.4 +11 -11 xml-xalan/c/src/XPath/FunctionSubstringAfter.hpp
Index: FunctionSubstringAfter.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstringAfter.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionSubstringAfter.hpp 2000/03/03 19:00:16 1.3
+++ FunctionSubstringAfter.hpp 2000/04/11 14:46:08 1.4
@@ -95,7 +95,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -105,24 +105,24 @@
context);
}
- const DOMString theFirstString = args[0]->str();
- const DOMString theSecondString = args[1]->str();
+ const XalanDOMString theFirstString = args[0]->str();
+ const XalanDOMString theSecondString = args[1]->str();
- const int theIndex =
indexOf(theFirstString,
-
theSecondString);
+ const unsigned int theIndex =
indexOf(theFirstString,
+
theSecondString);
+ const unsigned int theFirstStringLength =
length(theFirstString);
+
#if !defined(XALAN_NO_NAMESPACES)
using std::vector;
#endif
// This buffer will hold the output characters.
- vector<XMLCh> theBuffer;
+ vector<XalanDOMChar> theBuffer;
- if (theIndex != -1)
+ if (theIndex < theFirstStringLength)
{
- const int theFirstStringLength =
length(theFirstString);
-
- int theStartIndex = theIndex +
length(theSecondString);
+ unsigned int theStartIndex = theIndex +
length(theSecondString);
// The result string can only be as large as the source
string, so
// just reserve the space now. Also reserve a space
for the
@@ -135,7 +135,7 @@
}
}
- return
executionContext.getXObjectFactory().createString(DOMString(theBuffer.begin(),
theBuffer.size()));
+ return
executionContext.getXObjectFactory().createString(XalanDOMString(theBuffer.begin(),
theBuffer.size()));
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
1.4 +10 -12 xml-xalan/c/src/XPath/FunctionSubstringBefore.hpp
Index: FunctionSubstringBefore.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSubstringBefore.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionSubstringBefore.hpp 2000/03/03 19:00:16 1.3
+++ FunctionSubstringBefore.hpp 2000/04/11 14:46:08 1.4
@@ -96,7 +96,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -106,36 +106,34 @@
context);
}
- const DOMString theFirstString = args[0]->str();
- const DOMString theSecondString = args[1]->str();
+ const XalanDOMString theFirstString = args[0]->str();
+ const XalanDOMString theSecondString = args[1]->str();
- const int theIndex =
indexOf(theFirstString,
-
theSecondString);
+ const unsigned int theIndex =
indexOf(theFirstString,
+
theSecondString);
#if !defined(XALAN_NO_NAMESPACES)
using std::vector;
#endif
// This buffer will hold the output characters.
- vector<XMLCh> theBuffer;
+ vector<XalanDOMChar> theBuffer;
- if (theIndex != -1)
+ if (theIndex < length(theFirstString))
{
- const int theFirstStringLength =
length(theFirstString);
-
// The result string can only be as large as the source
string, so
// just reserve the space now. Also reserve a space
for the
// terminating 0.
- theBuffer.reserve(theFirstStringLength + 1);
+ theBuffer.reserve(theIndex + 2);
// Stop with the last character before the index.
- for (int i = 0; i < theIndex; i++)
+ for (unsigned int i = 0; i < theIndex; i++)
{
theBuffer.push_back(charAt(theFirstString, i));
}
}
- return
executionContext.getXObjectFactory().createString(DOMString(theBuffer.begin(),
theBuffer.size()));
+ return
executionContext.getXObjectFactory().createString(XalanDOMString(theBuffer.begin(),
theBuffer.size()));
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
1.5 +2 -2 xml-xalan/c/src/XPath/FunctionSum.hpp
Index: FunctionSum.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionSum.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FunctionSum.hpp 2000/03/03 19:00:17 1.4
+++ FunctionSum.hpp 2000/04/11 14:46:08 1.5
@@ -100,7 +100,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -118,7 +118,7 @@
for (unsigned int i = 0; i < count; i++)
{
- sum +=
DOMStringToDouble(executionContext.getNodeData(nl.item(i)));
+ sum +=
DOMStringToDouble(executionContext.getNodeData(*nl.item(i)));
}
return executionContext.getXObjectFactory().createNumber(sum);
1.4 +12 -12 xml-xalan/c/src/XPath/FunctionTranslate.hpp
Index: FunctionTranslate.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionTranslate.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionTranslate.hpp 2000/03/03 19:00:17 1.3
+++ FunctionTranslate.hpp 2000/04/11 14:46:08 1.4
@@ -99,7 +99,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
@@ -109,12 +109,12 @@
context);
}
- const DOMString theFirstString = args[0]->str();
- const DOMString theSecondString = args[1]->str();
- const DOMString theThirdString = args[2]->str();
+ const XalanDOMString theFirstString = args[0]->str();
+ const XalanDOMString theSecondString = args[1]->str();
+ const XalanDOMString theThirdString = args[2]->str();
- const int theFirstStringLength =
length(theFirstString);
- const int theThirdStringLength =
length(theThirdString);
+ const unsigned int theFirstStringLength =
length(theFirstString);
+ const unsigned int theThirdStringLength =
length(theThirdString);
#if !defined(XALAN_NO_NAMESPACES)
using std::vector;
@@ -122,20 +122,20 @@
// A vector to contain the new characters. We'll use it to
construct
// the result string.
- vector<XMLCh> theVector;
+ vector<XalanDOMChar> theVector;
// The result string can only be as large as the first string,
so
// just reserve the space now. Also reserve space for the
// terminating 0.
theVector.reserve(theFirstStringLength + 1);
- for (int i = 0; i < theFirstStringLength; i++)
+ for (unsigned int i = 0; i < theFirstStringLength; i++)
{
- const XMLCh theCurrentChar =
charAt(theFirstString, i);
+ const XalanDOMChar theCurrentChar =
charAt(theFirstString, i);
- const int theIndex =
indexOf(theSecondString, theCurrentChar);
+ const unsigned int theIndex =
indexOf(theSecondString, theCurrentChar);
- if (theIndex < 0)
+ if (theIndex >= theFirstStringLength)
{
// Didn't find the character in the second
string, so it
// is not translated.
@@ -160,7 +160,7 @@
// Push a terminating 0.
theVector.push_back(0);
- return
executionContext.getXObjectFactory().createString(DOMString(theVector.begin()));
+ return
executionContext.getXObjectFactory().createString(XalanDOMString(theVector.begin()));
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
1.4 +1 -1 xml-xalan/c/src/XPath/FunctionTrue.hpp
Index: FunctionTrue.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionTrue.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FunctionTrue.hpp 2000/03/03 19:00:17 1.3
+++ FunctionTrue.hpp 2000/04/11 14:46:09 1.4
@@ -95,7 +95,7 @@
virtual XObject*
execute(
XPathExecutionContext&
executionContext,
- const DOM_Node& context,
+ XalanNode*
context,
int
/* opPos */,
const XObjectArgVectorType& args)
{
1.6 +35 -243 xml-xalan/c/src/XPath/MutableNodeRefList.cpp
Index: MutableNodeRefList.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/MutableNodeRefList.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MutableNodeRefList.cpp 2000/03/16 20:50:12 1.5
+++ MutableNodeRefList.cpp 2000/04/11 14:46:09 1.6
@@ -64,15 +64,12 @@
-#include <dom/DOM_NamedNodeMap.hpp>
-#include <dom/DOM_NodeList.hpp>
+#include <XalanDOM/XalanNamedNodeMap.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanNodeList.hpp>
-#include <Include/DOMHelper.hpp>
-
-
-
#include "XPathSupport.hpp"
@@ -93,10 +90,9 @@
-MutableNodeRefList::MutableNodeRefList(const NodeRefListBase&
theSource,
-
XPathSupport* theSupport) :
+MutableNodeRefList::MutableNodeRefList(const NodeRefListBase&
theSource) :
NodeRefList(theSource),
- m_support(theSupport)
+ m_support(theSource.getSupport())
{
}
@@ -151,11 +147,14 @@
MutableNodeRefList&
-MutableNodeRefList::operator=(const DOM_NodeList& theRHS)
+MutableNodeRefList::operator=(const XalanNodeList* theRHS)
{
clear();
- addNodes(theRHS);
+ if (theRHS != 0)
+ {
+ addNodes(*theRHS);
+ }
return *this;
}
@@ -163,7 +162,7 @@
void
-MutableNodeRefList::addNode(const DOM_Node& n)
+MutableNodeRefList::addNode(XalanNode* n)
{
if (n != 0)
{
@@ -175,8 +174,8 @@
void
MutableNodeRefList::insertNode(
- const DOM_Node& n,
- unsigned int pos)
+ XalanNode* n,
+ unsigned int pos)
{
assert(getLength() >= pos);
@@ -189,12 +188,13 @@
void
-MutableNodeRefList::removeNode(const DOM_Node& n)
+MutableNodeRefList::removeNode(const XalanNode* n)
{
- using std::vector;
+#if !defined(XALAN_NO_NAMESPACES)
using std::find;
+#endif
- std::vector<DOM_Node>::iterator i =
+ NodeListVectorType::iterator i =
find(m_nodeList.begin(),
m_nodeList.end(),
n);
@@ -227,8 +227,8 @@
void
MutableNodeRefList::setNode(
- unsigned int pos,
- const DOM_Node& theNode)
+ unsigned int pos,
+ XalanNode* theNode)
{
assert(pos < getLength());
@@ -241,16 +241,13 @@
void
-MutableNodeRefList::addNodes(const DOM_NodeList& nodelist)
+MutableNodeRefList::addNodes(const XalanNodeList& nodelist)
{
- if (nodelist != 0)
- {
- const unsigned int theLength = nodelist.getLength();
+ const unsigned int theLength = nodelist.getLength();
- for (unsigned int i = 0; i < theLength; i++)
- {
- addNode(nodelist.item(i));
- }
+ for (unsigned int i = 0; i < theLength; i++)
+ {
+ addNode(nodelist.item(i));
}
}
@@ -270,7 +267,7 @@
void
-MutableNodeRefList::addNodesInDocOrder(const DOM_NodeList& nodelist)
+MutableNodeRefList::addNodesInDocOrder(const XalanNodeList&
nodelist)
{
const unsigned int nChildren = nodelist.getLength();
@@ -298,12 +295,13 @@
void
MutableNodeRefList::addNodeInDocOrder(
- const DOM_Node& node,
- bool test)
+ XalanNode* node,
+ bool test)
{
if (node != 0)
{
const unsigned int size = getLength();
+
if (test == false || m_support == 0 || size == 0)
{
addNode(node);
@@ -311,12 +309,13 @@
else
{
- unsigned int i = size - 1;
+ unsigned int i = size - 1;
// When wrap-around happens, i will be > than size...
for(; i < size; i--)
{
- const DOM_Node& child = m_nodeList[i];
+ const XalanNode* child = m_nodeList[i];
+ assert(child != 0);
if(child == node)
{
@@ -325,7 +324,7 @@
break;
}
- else if (isNodeAfter(node, child) == false)
+ else if (m_support->isNodeAfter(*node, *child)
== false)
{
break;
}
@@ -340,216 +339,9 @@
}
-
-bool
-MutableNodeRefList::isNodeAfter(
- const DOM_Node& node1,
- const DOM_Node& node2) const
-{
- assert(m_support != 0);
- assert(node1 != 0 && node2 != 0);
-
- bool isNodeAfter = false;
-
- DOM_Node parent1 = m_support->getParentOfNode(node1);
- DOM_Node parent2 = m_support->getParentOfNode(node2);
-
- // Optimize for most common case
- if(parent1 == parent2) // then we know they are siblings
- {
- isNodeAfter = isNodeAfterSibling(parent1,
-
node1,
-
node2);
- }
- else
- {
- // General strategy: Figure out the lengths of the two
- // ancestor chains, and walk up them looking for the
- // first common ancestor, at which point we can do a
- // sibling compare. Edge condition where one is the
- // ancestor of the other.
-
- // Count parents, so we can see if one of the chains
- // needs to be equalized.
- int nParents1 = 2;
- int nParents2 = 2; // count node & parent obtained above
-
- while(parent1 != 0)
- {
- nParents1++;
- parent1 = m_support->getParentOfNode(parent1);
- }
-
- while(parent2 != 0)
- {
- nParents2++;
- parent2 = m_support->getParentOfNode(parent2);
- }
-
- // adjustable starting points
- DOM_Node startNode1 = node1;
- DOM_Node startNode2 = node2;
-
- // Do I have to adjust the start point in one of
- // the ancesor chains?
- if(nParents1 < nParents2)
- {
- // adjust startNode2
- const int adjust = nParents2 - nParents1;
-
- for(int i = 0; i < adjust; i++)
- {
- startNode2 =
m_support->getParentOfNode(startNode2);
- }
- }
- else if(nParents1 > nParents2)
- {
- // adjust startNode1
- const int adjust = nParents1 - nParents2;
-
- for(int i = 0; i < adjust; i++)
- {
- startNode1 =
m_support->getParentOfNode(startNode1);
- }
- }
-
- // so we can "back up"
- DOM_Node prevChild1;
- DOM_Node prevChild2;
-
- // Loop up the ancestor chain looking for common parent.
- while(0 != startNode1)
- {
- if(startNode1 == startNode2) // common parent?
- {
- if(0 == prevChild1) // first time in loop?
- {
- // Edge condition: one is the ancestor
of the other.
- isNodeAfter = (nParents1 < nParents2) ?
true : false;
-
- break; // from while loop
- }
- else
- {
- isNodeAfter =
isNodeAfterSibling(startNode1,
-
prevChild1,
-
prevChild2);
-
- break; // from while loop
- }
- }
-
- prevChild1 = startNode1;
- startNode1 = m_support->getParentOfNode(startNode1);
- prevChild2 = startNode2;
- startNode2 = m_support->getParentOfNode(startNode2);
- }
- }
-
- /* -- please do not remove... very useful for diagnostics --
- System.out.println("node1 =
"+node1.getNodeName()+"("+node1.getNodeType()+")"+
- ", node2 = "+node2.getNodeName()
- +"("+node2.getNodeType()+")"+
- ", isNodeAfter = "+isNodeAfter); */
-
- return isNodeAfter;
-}
-
-
-bool
-MutableNodeRefList::isNodeAfterSibling(
- const DOM_Node& parent,
- const DOM_Node& child1,
- const DOM_Node& child2)
+XPathSupport*
+MutableNodeRefList::getSupport() const
{
- bool isNodeAfterSibling = false;
-
- const int child1type = child1.getNodeType();
- const int child2type = child2.getNodeType();
-
- if(DOM_Node::ATTRIBUTE_NODE != child1type &&
- DOM_Node::ATTRIBUTE_NODE == child2type)
- {
- // always sort attributes before non-attributes.
- isNodeAfterSibling = false;
- }
- else if(DOM_Node::ATTRIBUTE_NODE == child1type &&
- DOM_Node::ATTRIBUTE_NODE != child2type)
- {
- // always sort attributes before non-attributes.
- isNodeAfterSibling = true;
- }
- else if(DOM_Node::ATTRIBUTE_NODE == child1type)
- {
- DOM_NamedNodeMap children = parent.getAttributes();
-
- const unsigned int nNodes = children.getLength();
-
- bool found1 = false;
- bool found2 = false;
-
- for(unsigned int i = 0; i < nNodes; i++)
- {
- const DOM_Node child = children.item(i);
-
- if(child1 == child)
- {
- if(found2 == true)
- {
- isNodeAfterSibling = false;
- break;
- }
-
- found1 = true;
- }
- else if(child2 == child)
- {
- if(found1 == true)
- {
- isNodeAfterSibling = true;
- break;
- }
-
- found2 = true;
- }
- }
- }
- else
- {
- DOM_NodeList children = parent.getChildNodes();
-
- const int nNodes = children.getLength();
-
- bool found1 = false;
- bool found2 = false;
-
- for(int i = 0; i < nNodes; i++)
- {
- const DOM_Node child = children.item(i);
-
- if(child1 == child)
- {
- if(found2 == true)
- {
- isNodeAfterSibling = false;
- break;
- }
-
- found1 = true;
- }
- else if(child2 == child)
- {
- if(found1 == true)
- {
- isNodeAfterSibling = true;
- break;
- }
-
- found2 = true;
- }
- }
- }
-
- return isNodeAfterSibling;
+ return m_support;
}
1.4 +15 -36 xml-xalan/c/src/XPath/MutableNodeRefList.hpp
Index: MutableNodeRefList.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/MutableNodeRefList.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MutableNodeRefList.hpp 2000/03/03 19:00:17 1.3
+++ MutableNodeRefList.hpp 2000/04/11 14:46:09 1.4
@@ -68,11 +68,8 @@
-class DOM_NodeList;
-
-
-
class XPathSupport;
+class XalanNodeList;
@@ -103,11 +100,9 @@
* Construct a mutable node list from another list.
*
* @param theSource source list
- * @param theSupport XPath support class instance
*/
explicit
- MutableNodeRefList(const NodeRefListBase& theSource,
- XPathSupport*
theSupport = 0);
+ MutableNodeRefList(const NodeRefListBase& theSource);
virtual
~MutableNodeRefList();
@@ -122,7 +117,7 @@
operator=(const NodeRefListBase& theRHS);
MutableNodeRefList&
- operator=(const DOM_NodeList& theRHS);
+ operator=(const XalanNodeList* theRHS);
/**
* Add a node at to the list.
@@ -130,7 +125,7 @@
* @param n node to add
*/
virtual void
- addNode(const DOM_Node& n);
+ addNode(XalanNode* n);
/**
* Insert a node at a given position.
@@ -140,8 +135,8 @@
*/
virtual void
insertNode(
- const DOM_Node& n,
- unsigned int pos);
+ XalanNode* n,
+ unsigned int pos);
/**
* Remove a node from the list.
@@ -149,7 +144,7 @@
* @param n node to insert
*/
virtual void
- removeNode(const DOM_Node& n);
+ removeNode(const XalanNode* n);
/**
* Remove a node from the list.
@@ -172,8 +167,8 @@
* @param n node to insert, default is empty node
*/
virtual void
- setNode(unsigned int pos,
- const DOM_Node& n = DOM_Node());
+ setNode(unsigned int pos,
+ XalanNode* n = 0);
/**
* Copy NodeList members into this nodelist, adding in document order.
If
@@ -182,7 +177,7 @@
* @param nodelist node list to add
*/
virtual void
- addNodes(const DOM_NodeList& nodelist);
+ addNodes(const XalanNodeList& nodelist);
/**
* Copy NodeList members into this nodelist, adding in document order.
If
@@ -199,7 +194,7 @@
* @param nodelist node list to add
*/
virtual void
- addNodesInDocOrder(const DOM_NodeList& nodelist);
+ addNodesInDocOrder(const XalanNodeList& nodelist);
/**
* Copy NodeList members into this nodelist, adding in document order.
@@ -217,27 +212,11 @@
*/
virtual void
addNodeInDocOrder(
- const DOM_Node& node,
- bool test = false);
-
-protected:
+ XalanNode* node,
+ bool test = false);
- virtual bool
- isNodeAfter(
- const DOM_Node& node1,
- const DOM_Node& node2) const;
-
- static bool
- isNodeAfterSibling(
- const DOM_Node& parent,
- const DOM_Node& child1,
- const DOM_Node& child2);
-
- XPathSupport*
- getSupport() const
- {
- return m_support;
- }
+ virtual XPathSupport*
+ getSupport() const;
private:
1.3 +11 -9 xml-xalan/c/src/XPath/NameSpace.hpp
Index: NameSpace.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NameSpace.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NameSpace.hpp 2000/03/03 19:00:17 1.2
+++ NameSpace.hpp 2000/04/11 14:46:09 1.3
@@ -68,7 +68,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -88,8 +88,8 @@
* @param uri URI of namespace
*/
NameSpace(
- const DOMString& prefix = DOMString(),
- const DOMString& uri = DOMString()) :
+ const XalanDOMString& prefix = XalanDOMString(),
+ const XalanDOMString& uri = XalanDOMString()) :
m_prefix(prefix),
m_uri(uri),
m_resultCandidate(true)
@@ -101,7 +101,7 @@
*
* @return prefix string
*/
- const DOMString&
+ const XalanDOMString&
getPrefix() const
{
return m_prefix;
@@ -112,7 +112,7 @@
*
* @return URI string
*/
- const DOMString&
+ const XalanDOMString&
getURI() const
{
return m_uri;
@@ -145,7 +145,8 @@
*
* @param theRHS namespace to assign
*/
- NameSpace& operator=(const NameSpace& theRHS)
+ NameSpace&
+ operator=(const NameSpace& theRHS)
{
if (&theRHS != this)
{
@@ -153,14 +154,15 @@
m_uri = theRHS.m_uri;
m_resultCandidate = theRHS.m_resultCandidate;
}
+
return *this;
}
private:
- DOMString m_prefix;
- DOMString m_uri; // if length is 0, then
Element namespace is empty.
- bool m_resultCandidate;
+ XalanDOMString m_prefix;
+ XalanDOMString m_uri; // if length is 0, then Element namespace is
empty.
+ bool m_resultCandidate;
};
1.5 +8 -6 xml-xalan/c/src/XPath/NodeListImplSurrogate.cpp
Index: NodeListImplSurrogate.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeListImplSurrogate.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeListImplSurrogate.cpp 2000/02/04 19:07:48 1.4
+++ NodeListImplSurrogate.cpp 2000/04/11 14:46:09 1.5
@@ -58,7 +58,7 @@
-#include <Include/DOMHelper.hpp>
+#include <cassert>
@@ -67,7 +67,7 @@
NodeListImplSurrogate::NodeListImplSurrogate(NodeRefListBase&
theNodeRefList) :
- NodeListImpl(),
+ XalanNodeList(),
m_nodeRefList(theNodeRefList)
{
}
@@ -80,16 +80,18 @@
-NodeImpl*
-NodeListImplSurrogate::item(unsigned int index)
+XalanNode*
+NodeListImplSurrogate::item(unsigned int index) const
{
- return
XALAN_DOM_NodeHack(m_nodeRefList.item(index)).getImplementationObject();
+ assert(index < getLength());
+
+ return m_nodeRefList.item(index);
}
unsigned int
-NodeListImplSurrogate::getLength()
+NodeListImplSurrogate::getLength() const
{
return m_nodeRefList.getLength();
}
1.5 +6 -7 xml-xalan/c/src/XPath/NodeListImplSurrogate.hpp
Index: NodeListImplSurrogate.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeListImplSurrogate.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeListImplSurrogate.hpp 2000/03/03 19:00:17 1.4
+++ NodeListImplSurrogate.hpp 2000/04/11 14:46:09 1.5
@@ -64,16 +64,15 @@
-#include <dom/NodeListImpl.hpp>
+#include <XalanDOM/XalanNodeList.hpp>
-class NodeImpl;
class NodeRefListBase;
-class XALAN_XPATH_EXPORT NodeListImplSurrogate : public NodeListImpl
+class XALAN_XPATH_EXPORT NodeListImplSurrogate : public XalanNodeList
{
public:
@@ -87,13 +86,13 @@
virtual
~NodeListImplSurrogate();
- // These interfaces are inherited from NodeListImpl...
+ // These interfaces are inherited from XalanNodeList...
- virtual NodeImpl*
- item(unsigned int index);
+ virtual XalanNode*
+ item(unsigned int index) const;
virtual unsigned int
- getLength();
+ getLength() const;
private:
1.5 +15 -7 xml-xalan/c/src/XPath/NodeRefList.cpp
Index: NodeRefList.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeRefList.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeRefList.cpp 2000/02/18 22:19:23 1.4
+++ NodeRefList.cpp 2000/04/11 14:46:09 1.5
@@ -102,13 +102,13 @@
{
m_nodeList.clear();
- const int theLength = theRHS.getLength();
+ const unsigned int theLength = theRHS.getLength();
m_nodeList.reserve(theLength);
- for(int i = 0; i < theLength; i++)
+ for(unsigned int i = 0; i < theLength; i++)
{
- const DOM_Node theNode = theRHS.item(i);
+ XalanNode* const theNode = theRHS.item(i);
if (theNode != 0)
{
@@ -141,7 +141,7 @@
-DOM_Node
+XalanNode*
NodeRefList::item(unsigned int index) const
{
assert(index < m_nodeList.size());
@@ -160,7 +160,7 @@
unsigned int
-NodeRefList::indexOf(const DOM_Node& theNode) const
+NodeRefList::indexOf(const XalanNode* theNode) const
{
#if !defined(XALAN_NO_NAMESPACES)
using std::find;
@@ -172,7 +172,15 @@
m_nodeList.end(),
theNode);
- // If not found, return -1. Otherwise, subtract the iterator
+ // If not found, return npos. Otherwise, subtract the iterator
// from the first iterator to get the distance between them.
- return i == m_nodeList.end() ? -1 : i - m_nodeList.begin();
+ return i == m_nodeList.end() ? npos : i - m_nodeList.begin();
+}
+
+
+
+XPathSupport*
+NodeRefList::getSupport() const
+{
+ return 0;
}
1.6 +7 -4 xml-xalan/c/src/XPath/NodeRefList.hpp
Index: NodeRefList.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeRefList.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NodeRefList.hpp 2000/03/03 19:00:17 1.5
+++ NodeRefList.hpp 2000/04/11 14:46:09 1.6
@@ -109,21 +109,24 @@
// These methods are inherited from NodeRefListBase ...
- virtual DOM_Node
+ virtual XalanNode*
item(unsigned int index) const;
virtual unsigned int
getLength() const;
virtual unsigned int
- indexOf(const DOM_Node& theNode) const;
+ indexOf(const XalanNode* theNode) const;
+ virtual XPathSupport*
+ getSupport() const;
+
protected:
#if defined(XALAN_NO_NAMESPACES)
- typedef vector<DOM_Node> NodeListVectorType;
+ typedef vector<XalanNode*> NodeListVectorType;
#else
- typedef std::vector<DOM_Node> NodeListVectorType;
+ typedef std::vector<XalanNode*> NodeListVectorType;
#endif
NodeListVectorType m_nodeList;
1.2 +12 -0 xml-xalan/c/src/XPath/NodeRefListBase.cpp
Index: NodeRefListBase.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeRefListBase.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NodeRefListBase.cpp 1999/12/18 19:47:54 1.1
+++ NodeRefListBase.cpp 2000/04/11 14:46:10 1.2
@@ -59,6 +59,18 @@
+#if !defined(XALAN_INLINE_INITIALIZATION)
+#include <climits>
+#endif
+
+
+
+#if !defined(XALAN_INLINE_INITIALIZATION)
+const unsigned int NodeRefListBase::npos = UINT_MAX;
+#endif
+
+
+
NodeRefListBase::NodeRefListBase()
{
}
1.5 +19 -3 xml-xalan/c/src/XPath/NodeRefListBase.hpp
Index: NodeRefListBase.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeRefListBase.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- NodeRefListBase.hpp 2000/03/03 19:00:17 1.4
+++ NodeRefListBase.hpp 2000/04/11 14:46:10 1.5
@@ -64,10 +64,17 @@
-#include <dom/DOM_Node.hpp>
+#if defined(XALAN_INLINE_INITIALIZATION)
+#include <climits>
+#endif
+class XalanNode;
+class XPathSupport;
+
+
+
/**
* Local implementation of NodeRefList. This class is for internal use only.
*/
@@ -91,7 +98,7 @@
* <code>NodeList</code>, or <code>null</code> if that is not a
* valid index
*/
- virtual DOM_Node
+ virtual XalanNode*
item(unsigned int index) const = 0;
/**
@@ -110,7 +117,16 @@
* @return index of node
*/
virtual unsigned int
- indexOf(const DOM_Node& theNode) const = 0;
+ indexOf(const XalanNode* theNode) const = 0;
+
+ virtual XPathSupport*
+ getSupport() const = 0;
+
+#if defined(XALAN_INLINE_INITIALIZATION)
+ static const unsigned int npos = UINT_MAX;
+#else
+ static const unsigned int npos;
+#endif
protected:
1.4 +4 -5 xml-xalan/c/src/XPath/PrefixResolver.hpp
Index: PrefixResolver.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/PrefixResolver.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PrefixResolver.hpp 2000/03/03 19:00:17 1.3
+++ PrefixResolver.hpp 2000/04/11 14:46:10 1.4
@@ -64,7 +64,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -76,7 +76,6 @@
{
public:
- explicit
PrefixResolver();
virtual
@@ -90,15 +89,15 @@
* @param prefix Prefix to resolve
* @return namespace that prefix resolves to, or null if prefix is not
found
*/
- virtual DOMString
- getNamespaceForPrefix(const DOMString& prefix) const = 0;
+ virtual XalanDOMString
+ getNamespaceForPrefix(const XalanDOMString& prefix) const =
0;
/**
* Retrieve the base URI for the resolver.
*
* @return URI string
*/
- virtual DOMString
+ virtual XalanDOMString
getURI() const = 0;
};
1.7 +90 -52 xml-xalan/c/src/XPath/QName.cpp
Index: QName.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/QName.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- QName.cpp 2000/03/07 16:11:14 1.6
+++ QName.cpp 2000/04/11 14:46:10 1.7
@@ -59,10 +59,6 @@
-#include <Include/DOMHelper.hpp>
-
-
-
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/STLHelper.hpp>
#include <PlatformSupport/XSLException.hpp>
@@ -81,8 +77,8 @@
QName::QName(
- const DOMString& theNamespace,
- const DOMString& theLocalPart) :
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& theLocalPart) :
m_namespace(theNamespace),
m_localpart(theLocalPart)
{
@@ -91,22 +87,22 @@
QName::QName(
- const DOMString& qname,
+ const XalanDOMString& qname,
const NamespacesStackType& namespaces) :
m_namespace(),
m_localpart()
{
- const int indexOfNSSep = indexOf(qname, ':');
+ const unsigned int indexOfNSSep = indexOf(qname, ':');
- if(indexOfNSSep > 0)
+ if(indexOfNSSep < length(qname))
{
- const DOMString prefix = substring(qname, 0,
indexOfNSSep);
- if(prefix.equals("xmlns"))
+ const XalanDOMString prefix = substring(qname, 0,
indexOfNSSep);
+ if(::equals(prefix, XALAN_STATIC_UCODE_STRING("xmlns")))
return;
m_namespace = getNamespaceForPrefix(namespaces, prefix);
if(0 == length(m_namespace))
{
- throw XSLException(DOMString("Prefix must resolve to a
namespace: ") + prefix);
+ throw XSLException(XalanDOMString("Prefix must resolve
to a namespace: ") + prefix);
}
m_localpart = substring(qname, indexOfNSSep + 1);
}
@@ -117,8 +113,8 @@
QName::QName(
- const DOMString& qname,
- const DOM_Element& namespaceContext,
+ const XalanDOMString& qname,
+ const XalanElement* namespaceContext,
const XPathEnvSupport& envSupport,
const XPathSupport& support) :
m_namespace(),
@@ -132,7 +128,7 @@
QName::QName(
- const DOMString& qname,
+ const XalanDOMString& qname,
const PrefixResolver& theResolver) :
m_namespace(),
m_localpart()
@@ -159,24 +155,25 @@
void
QName::resolvePrefix(
- const DOMString& qname,
+ const XalanDOMString& qname,
const PrefixResolver& theResolver)
{
- const int indexOfNSSep = indexOf(qname, ':');
+ const unsigned int indexOfNSSep = indexOf(qname, ':');
+ const unsigned int theLength = length(qname);
- if(indexOfNSSep > 0)
+ if(indexOfNSSep < theLength)
{
- const DOMString prefix = substring(qname, 0,
indexOfNSSep);
+ const XalanDOMString prefix = substring(qname, 0,
indexOfNSSep);
- if(::equals(prefix, "xml"))
+ if(::equals(prefix, XALAN_STATIC_UCODE_STRING("xml")))
{
m_namespace = DOMServices::s_XMLNamespaceURI;
}
// The default namespace is not resolved.
- else if(prefix.equals("xmlns"))
- {
- return;
- }
+ else if(::equals(prefix, XALAN_STATIC_UCODE_STRING("xmlns")))
+ {
+ return;
+ }
else
{
m_namespace = theResolver.getNamespaceForPrefix(prefix);
@@ -184,7 +181,7 @@
if(0 == length(m_namespace))
{
- throw XSLException(DOMString("Prefix must resolve to a
namespace: ") + prefix);
+ throw XSLException(XalanDOMString("Prefix must resolve
to a namespace: ") + prefix);
}
}
else
@@ -192,15 +189,23 @@
// $$$ ToDo: error or warning...
}
- m_localpart = indexOfNSSep < 0 ? qname : substring(qname, indexOfNSSep
+ 1);
+ m_localpart = indexOfNSSep == theLength ? qname : substring(qname,
indexOfNSSep + 1);
}
+
+
-DOMString QName::getNamespaceForPrefix(const NamespaceVectorType& namespaces,
- const DOMString& prefix, bool reverse /* true */)
+XalanDOMString
+QName::getNamespaceForPrefix(
+ const NamespaceVectorType& namespaces,
+ const XalanDOMString& prefix,
+ bool reverse)
{
- DOMString nsURI;
- if(::equals(prefix, "xml"))
+ XalanDOMString nsURI;
+
+ if(::equals(prefix, XALAN_STATIC_UCODE_STRING("xml")))
+ {
nsURI = DOMServices::s_XMLNamespaceURI;
+ }
else
{
if (reverse)
@@ -208,9 +213,11 @@
for(int j = namespaces.size()-1; j >= 0; j--)
{
const NameSpace& ns = namespaces[j];
- const DOMString& thisPrefix = ns.getPrefix();
- if((0 != thisPrefix.length()) &&
prefix.equals(thisPrefix))
+ const XalanDOMString& thisPrefix =
ns.getPrefix();
+ if(::equals(prefix, thisPrefix))
+ {
return ns.getURI();
+ }
}
}
else
@@ -218,48 +225,78 @@
for(unsigned int j = 0; j < namespaces.size(); j++)
{
const NameSpace& ns = namespaces[j];
- const DOMString& thisPrefix = ns.getPrefix();
- if((0 != thisPrefix.length()) &&
prefix.equals(thisPrefix))
+ const XalanDOMString& thisPrefix =
ns.getPrefix();
+ if(::equals(prefix, thisPrefix))
+ {
return ns.getURI();
+ }
}
}
}
return nsURI;
}
-
-DOMString QName::getNamespaceForPrefix(const NamespacesStackType& nsStack,
- const DOMString& prefix, bool reverse /* true */)
+
+
+
+XalanDOMString
+QName::getNamespaceForPrefix(
+ const NamespacesStackType& nsStack,
+ const XalanDOMString& prefix,
+ bool reverse)
{
- DOMString nsURI;
+ XalanDOMString nsURI;
+
const int depth = nsStack.size();
+
for(int i = depth-1; i >= 0; i--)
{
const NamespaceVectorType& namespaces = nsStack[i];
nsURI = QName::getNamespaceForPrefix(namespaces, prefix,
reverse);
if (! ::isEmpty(nsURI))
- return nsURI;
+ break;
}
+
return nsURI;
}
+
+
-DOMString QName::getPrefixForNamespace(const NamespaceVectorType& namespaces,
- const DOMString& uri, bool /* reverse */ /* true */)
+XalanDOMString
+QName::getPrefixForNamespace(
+ const NamespaceVectorType& namespaces,
+ const XalanDOMString& uri,
+ bool /*
reverse */)
{
+ XalanDOMString thePrefix;
+
for(int j = namespaces.size()-1; j >= 0; j--)
{
- const NameSpace& ns = namespaces[j];
- const DOMString& thisPrefix = ns.getURI();
- if((0 != thisPrefix.length()) && uri.equals(thisPrefix))
- return ns.getPrefix();
+ const NameSpace& ns = namespaces[j];
+ const XalanDOMString& thisURI = ns.getURI();
+
+ if(::equals(uri, thisURI))
+ {
+ thePrefix = ns.getPrefix();
+
+ break;
+ }
}
- return DOMString();
+
+ return thePrefix;
}
+
+
-DOMString QName::getPrefixForNamespace(const NamespacesStackType& nsStack,
- const DOMString& uri, bool reverse /* true */)
+XalanDOMString
+QName::getPrefixForNamespace(
+ const NamespacesStackType& nsStack,
+ const XalanDOMString& uri,
+ bool reverse)
{
- DOMString prefix;
- const int depth = nsStack.size();
+ XalanDOMString prefix;
+
+ const int depth = nsStack.size();
+
if (reverse)
{
for(int i = depth-1; i >= 0; i--)
@@ -267,7 +304,7 @@
const NamespaceVectorType& namespaces = nsStack[i];
prefix = QName::getPrefixForNamespace(namespaces, uri,
reverse);
if (! ::isEmpty(prefix))
- return prefix;
+ break;
}
}
else
@@ -277,8 +314,9 @@
const NamespaceVectorType& namespaces = nsStack[i];
prefix = QName::getPrefixForNamespace(namespaces, uri,
reverse);
if (! ::isEmpty(prefix))
- return prefix;
+ break;
}
}
+
return prefix;
}
1.7 +21 -21 xml-xalan/c/src/XPath/QName.hpp
Index: QName.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/QName.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- QName.hpp 2000/03/03 19:00:17 1.6
+++ QName.hpp 2000/04/11 14:46:10 1.7
@@ -68,7 +68,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -76,7 +76,7 @@
-class DOM_Element;
+class XalanElement;
class NameSpace;
class PrefixResolver;
class XPathEnvSupport;
@@ -115,8 +115,8 @@
* @param theLocalPart local part string
*/
QName(
- const DOMString& theNamespace = DOMString(),
- const DOMString& theLocalPart = DOMString());
+ const XalanDOMString& theNamespace = XalanDOMString(),
+ const XalanDOMString& theLocalPart =
XalanDOMString());
/**
* Construct a QName from a string, resolving the prefix using the given
@@ -126,7 +126,7 @@
* @param namespaces namespace vector stack to use
*/
QName(
- const DOMString& qname,
+ const XalanDOMString& qname,
const NamespacesStackType& namespaces);
/**
@@ -139,8 +139,8 @@
* @param support XPath support class instance
*/
QName(
- const DOMString& qname,
- const DOM_Element& namespaceContext,
+ const XalanDOMString& qname,
+ const XalanElement* namespaceContext,
const XPathEnvSupport& envSupport,
const XPathSupport& support);
@@ -152,7 +152,7 @@
* @param theResolver prefix resolver to use
*/
QName(
- const DOMString& qname,
+ const XalanDOMString& qname,
const PrefixResolver& theResolver);
~QName();
@@ -162,7 +162,7 @@
*
* @return local part string
*/
- const DOMString&
+ const XalanDOMString&
getLocalPart() const
{
return m_localpart;
@@ -173,7 +173,7 @@
*
* @return namespace string
*/
- const DOMString&
+ const XalanDOMString&
getNamespace() const
{
return m_namespace;
@@ -219,8 +219,8 @@
* @param prefix namespace prefix to find
* @param reverse true to search vector from last to first, default
true
*/
- static DOMString getNamespaceForPrefix(const NamespaceVectorType&
namespaces,
- const DOMString& prefix, bool reverse=true);
+ static XalanDOMString getNamespaceForPrefix(const NamespaceVectorType&
namespaces,
+ const XalanDOMString& prefix, bool reverse=true);
/**
* Get the namespace from a prefix by searching a stack of namespace
@@ -230,8 +230,8 @@
* @param prefix namespace prefix to find
* @param reverse true to search vector from last to first, default true
*/
- static DOMString getNamespaceForPrefix(const NamespacesStackType&
nsStack,
- const DOMString& prefix, bool reverse=true);
+ static XalanDOMString getNamespaceForPrefix(const NamespacesStackType&
nsStack,
+ const XalanDOMString& prefix, bool reverse=true);
/**
* Get the prefix for a namespace by searching a vector of namespaces.
@@ -240,8 +240,8 @@
* @param uri URI string for namespace to find
* @param reverse true to search vector from last to first, default
true
*/
- static DOMString getPrefixForNamespace(const NamespaceVectorType&
namespaces,
- const DOMString& uri, bool reverse=true);
+ static XalanDOMString getPrefixForNamespace(const NamespaceVectorType&
namespaces,
+ const XalanDOMString& uri, bool reverse=true);
/**
* Get the prefix for a namespace by searching a stack of namespace
@@ -251,19 +251,19 @@
* @param uri URI string for namespace to find
* @param reverse true to search vector from last to first, default true
*/
- static DOMString getPrefixForNamespace(const NamespacesStackType&
nsStack,
- const DOMString& uri, bool reverse=true);
+ static XalanDOMString getPrefixForNamespace(const NamespacesStackType&
nsStack,
+ const XalanDOMString& uri, bool reverse=true);
private:
void
resolvePrefix(
- const DOMString& qname,
+ const XalanDOMString& qname,
const PrefixResolver& theResolver);
- DOMString m_namespace;
+ XalanDOMString m_namespace;
- DOMString m_localpart;
+ XalanDOMString m_localpart;
};
1.6 +112 -174 xml-xalan/c/src/XPath/ResultTreeFrag.cpp
Index: ResultTreeFrag.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFrag.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ResultTreeFrag.cpp 2000/02/17 20:29:52 1.5
+++ ResultTreeFrag.cpp 2000/04/11 14:46:10 1.6
@@ -63,15 +63,11 @@
-#include <Include/DOMHelper.hpp>
-
-
-
ResultTreeFrag::ResultTreeFrag(
- const DOM_Document& theFactory,
- XPathSupport& theSupport) :
- ResultTreeFragBase(theFactory),
- m_document(theFactory),
+ XalanDocument& theOwnerDocument,
+ XPathSupport& theSupport) :
+ ResultTreeFragBase(),
+ m_document(&theOwnerDocument),
m_children(&theSupport),
m_surrogate(m_children)
{
@@ -88,11 +84,11 @@
{
if (deepClone == true)
{
- const int theLength = theSource.getLength();
+ const int theLength = theSource.m_children.getLength();
for (int i = 0; i < theLength; i++)
{
- m_children.addNode(theSource.item(i).cloneNode(true));
+
m_children.addNode(theSource.m_children.item(i)->cloneNode(true));
}
}
}
@@ -104,192 +100,124 @@
}
-
-NodeImpl*
-ResultTreeFrag::item(unsigned int index)
-{
- return
XALAN_DOM_NodeHack(m_children.item(index)).getImplementationObject();
-};
-
-
-unsigned int
-ResultTreeFrag::getLength()
+XalanDOMString
+ResultTreeFrag::getNodeName() const
{
- return m_children.getLength();
-};
-
-
-
-NodeImpl*
-ResultTreeFrag::appendChild(NodeImpl* newChild)
-{
- XALAN_DOM_NodeHack theHack(newChild);
-
- theHack = appendChild(theHack);
-
- return theHack.getImplementationObject();
+ return XalanDOMString();
}
-void
-ResultTreeFrag::changed()
+XalanDOMString
+ResultTreeFrag::getNodeValue() const
{
+ return XalanDOMString();
}
-NodeImpl*
-ResultTreeFrag::cloneNode(bool deep)
+ResultTreeFrag::NodeType
+ResultTreeFrag::getNodeType() const
{
-#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- return dynamic_cast<ResultTreeFrag*>(clone(deep));
-#else
- clone(deep);
-#endif
+ return DOCUMENT_FRAGMENT_NODE;
}
-NamedNodeMapImpl*
-ResultTreeFrag::getAttributes()
+XalanNode*
+ResultTreeFrag::getParentNode() const
{
return 0;
}
-NodeListImpl*
-ResultTreeFrag::getChildNodes()
+const XalanNodeList*
+ResultTreeFrag::getChildNodes() const
{
return &m_surrogate;
}
-
-NodeImpl*
-ResultTreeFrag::getFirstChild()
-{
- return XALAN_DOM_NodeHack(m_children.item(0)).getImplementationObject();
-}
-
-
-
-NodeImpl*
-ResultTreeFrag::getLastChild()
-{
- return XALAN_DOM_NodeHack(m_children.item(m_children.getLength() -
1)).getImplementationObject();
-}
-
-
-
-DocumentImpl*
-ResultTreeFrag::getOwnerDocument()
-{
- XALAN_DOM_NodeHack theHack(m_document);
-
- return dynamic_cast<DocumentImpl*>(theHack.getImplementationObject());
-}
-
-
-
-bool
-ResultTreeFrag::hasChildNodes()
-{
- return const_cast<const ResultTreeFrag*>(this)->hasChildNodes();
-}
-
-
-NodeImpl*
-ResultTreeFrag::insertBefore(
- NodeImpl* newChild,
- NodeImpl* refChild)
+XalanNode*
+ResultTreeFrag::getFirstChild() const
{
- XALAN_DOM_NodeHack
theHack(insertBefore(XALAN_DOM_NodeHack(newChild),
-
XALAN_DOM_NodeHack(refChild)));
-
- return theHack.getImplementationObject();
+ return m_children.getLength() == 0 ? 0 : m_children.item(0);
}
-NodeImpl*
-ResultTreeFrag::removeChild(NodeImpl* oldChild)
+XalanNode*
+ResultTreeFrag::getLastChild() const
{
- XALAN_DOM_NodeHack
theHack(removeChild(XALAN_DOM_NodeHack(oldChild)));
+ const unsigned int theLength = m_children.getLength();
+
- return theHack.getImplementationObject();
+ return theLength == 0 ? 0 : m_children.item(theLength - 1);
}
-NodeImpl*
-ResultTreeFrag::replaceChild(
- NodeImpl* newChild,
- NodeImpl* oldChild)
+XalanNode*
+ResultTreeFrag::getPreviousSibling() const
{
- XALAN_DOM_NodeHack
theHack(replaceChild(XALAN_DOM_NodeHack(newChild),
-
XALAN_DOM_NodeHack(oldChild)));
-
- return theHack.getImplementationObject();
+ return 0;
}
-
-void
-ResultTreeFrag::setReadOnly(
- bool /* readOnly */,
- bool /* deep */)
-{
-}
-
-DOMString
-toString()
+XalanNode*
+ResultTreeFrag::getNextSibling() const
{
- // $$$ ToTo: Fix this!!!
- return DOMString();
+ return 0;
}
-DOM_Node
-ResultTreeFrag::getFirstChild() const
+const XalanNamedNodeMap*
+ResultTreeFrag::getAttributes() const
{
- return m_children.getLength() > 0 ? m_children.item(0) : DOM_Node();
+ return 0;
}
-DOM_Node
-ResultTreeFrag::getLastChild() const
+XalanDocument*
+ResultTreeFrag::getOwnerDocument() const
{
- const int theLength = m_children.getLength();
-
- return theLength > 0 ? m_children.item(theLength - 1) : DOM_Node();
+ return m_document;
}
-DOM_Document
-ResultTreeFrag::getOwnerDocument() const
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XalanNode*
+#else
+ResultTreeFrag*
+#endif
+ResultTreeFrag::cloneNode(bool deep) const
{
- return m_document;
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ return new ResultTreeFrag(*this,
+ deep);
+#else
+ return clone(deep);
+#endif
}
-DOM_Node
+XalanNode*
ResultTreeFrag::insertBefore(
- const DOM_Node& newChild,
- const DOM_Node& refChild)
+ XalanNode* newChild,
+ XalanNode* refChild)
{
- const int refIndex = 0 == refChild ? m_children.getLength() :
+ const unsigned int refIndex = 0 == refChild ?
m_children.getLength() :
m_children.indexOf(refChild);
- assert(refIndex >= 0);
+ assert(refIndex != m_children.npos);
m_children.insertNode(newChild, refIndex);
@@ -298,23 +226,23 @@
-DOM_Node
+XalanNode*
ResultTreeFrag::replaceChild(
- const DOM_Node& newChild,
- const DOM_Node& oldChild)
+ XalanNode* newChild,
+ XalanNode* oldChild)
{
- const int refIndex =
- 0 == oldChild ? -1 : m_children.indexOf(oldChild);
+ const unsigned int refIndex =
+ 0 == oldChild ? m_children.npos : m_children.indexOf(oldChild);
- if(refIndex > -1)
+ if(refIndex != m_children.npos)
{
- const int newChildIndex = m_children.indexOf(newChild);
+ const unsigned int newChildIndex =
m_children.indexOf(newChild);
// Set the new child first, then erase it from
// the old position. if it's there.
m_children.setNode(refIndex, newChild);
- if(newChildIndex > -1)
+ if(newChildIndex != m_children.npos)
{
m_children.removeNode(newChildIndex);
}
@@ -325,66 +253,85 @@
-DOM_Node
-ResultTreeFrag::removeChild(const DOM_Node& oldChild)
+XalanNode*
+ResultTreeFrag::appendChild(XalanNode* newChild)
{
+ assert(newChild != 0);
+
+ m_children.addNode(newChild);
+ assert(m_children.item(m_children.getLength() - 1) == newChild);
+
+ return newChild;
+}
+
+
+
+XalanNode*
+ResultTreeFrag::removeChild(XalanNode* oldChild)
+{
m_children.removeNode(oldChild);
+ assert(m_children.indexOf(oldChild) == m_children.npos);
return oldChild;
}
-
-DOM_Node
-ResultTreeFrag::appendChild(const DOM_Node& newChild)
+bool
+ResultTreeFrag::hasChildNodes() const
{
- m_children.addNode(newChild);
+ return m_children.getLength() > 0 ? true : false;
+}
- return newChild;
+
+
+void
+ResultTreeFrag::setNodeValue(const XalanDOMString& /* nodeValue */)
+{
}
-const NodeRefListBase&
-ResultTreeFrag::getChildNodesAsNodeRefList() const
+void
+ResultTreeFrag::normalize()
{
- return m_children;
}
bool
-ResultTreeFrag::hasChildNodes() const
+ResultTreeFrag::supports(
+ const XalanDOMString& /* feature */,
+ const XalanDOMString& /* version */) const
{
- return m_children.getLength() > 0 ? true : false;
+ return false;
}
-unsigned int
-ResultTreeFrag::getLength() const
+XalanDOMString
+ResultTreeFrag::getNamespaceURI() const
{
- return m_children.getLength();
-};
-
+ return XalanDOMString();
+}
-DOM_Node
-ResultTreeFrag::item(unsigned int index) const
+XalanDOMString
+ResultTreeFrag::getPrefix() const
{
- return m_children.item(index);
-};
+ return XalanDOMString();
+}
+XalanDOMString
+ResultTreeFrag::getLocalName() const
+{
+ return XalanDOMString();
+}
-DOM_Node
-ResultTreeFrag::cloneNode(bool deep) const
+
+void
+ResultTreeFrag::setPrefix(const XalanDOMString& /* prefix */)
{
-#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- return
DOM_ResultTreeFragBase(dynamic_cast<ResultTreeFrag*>(clone(deep)));
-#else
- return DOM_ResultTreeFragBase(clone(deep));
-#endif
}
@@ -395,15 +342,6 @@
ResultTreeFrag*
#endif
ResultTreeFrag::clone(bool deep) const
-{
- return new ResultTreeFrag(*this,
- deep);
-}
-
-
-
-DOMString
-ResultTreeFrag::toString()
{
- return DOMString();
+ return new ResultTreeFrag(*this, deep);
}
1.6 +82 -103 xml-xalan/c/src/XPath/ResultTreeFrag.hpp
Index: ResultTreeFrag.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFrag.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ResultTreeFrag.hpp 2000/03/03 19:00:18 1.5
+++ ResultTreeFrag.hpp 2000/04/11 14:46:10 1.6
@@ -64,7 +64,7 @@
-#include <dom/DOM_Document.hpp>
+#include <XalanDOM/XalanDocument.hpp>
@@ -88,12 +88,12 @@
/**
* Construct a result tree fragment object from a DOM document.
*
- * @param theFactory document used to construct result tree fragment
- * @param theSupport XPath support class instance
+ * @param theOwnerDocument The document used to construct result tree
fragment
+ * @param theSupport The XPathSupport instance
*/
ResultTreeFrag(
- const DOM_Document& theFactory,
- XPathSupport& theSupport);
+ XalanDocument& theOwnerDocument,
+ XPathSupport& theSupport);
/**
* Construct a result tree fragment object from another.
@@ -107,133 +107,112 @@
virtual
~ResultTreeFrag();
- // These interfaces are inherited from Cloneable...
-#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- virtual Cloneable*
-#else
- virtual ResultTreeFrag*
-#endif
- clone(bool deep) const;
+ ResultTreeFrag&
+ operator=(const ResultTreeFrag& theRHS)
+ {
+ if (&theRHS != this)
+ {
+ ResultTreeFragBase::operator==(theRHS);
- // These interfaces are inherited from UnimplementedDocumentFragment...
+ m_document = theRHS.m_document;
+ m_children = m_children;
+ }
- // These interfaces are inherited from NodeListImpl...
+ return *this;
+ }
- virtual NodeImpl*
- item(unsigned int index);
- virtual unsigned int
- getLength();
+ // These interfaces are inherited from XalanDocumentFragment...
+ virtual XalanDOMString
+ getNodeName() const;
- // These interfaces are inherited from NodeImpl...
+ virtual XalanDOMString
+ getNodeValue() const;
-#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- virtual NodeImpl*
-#else
- virtual UnimplementedDocumentFragment*
-#endif
- cloneNode(bool deep);
+ virtual NodeType
+ getNodeType() const;
- virtual NodeImpl*
- appendChild(NodeImpl* newChild);
+ virtual XalanNode*
+ getParentNode() const;
- virtual void
- changed();
+ virtual const XalanNodeList*
+ getChildNodes() const;
- virtual NamedNodeMapImpl*
- getAttributes();
+ virtual XalanNode*
+ getFirstChild() const;
- virtual NodeListImpl*
- getChildNodes();
+ virtual XalanNode*
+ getLastChild() const;
- virtual NodeImpl*
- getFirstChild();
+ virtual XalanNode*
+ getPreviousSibling() const;
- virtual NodeImpl*
- getLastChild();
+ virtual XalanNode*
+ getNextSibling() const;
- virtual DocumentImpl*
- getOwnerDocument();
+ virtual const XalanNamedNodeMap*
+ getAttributes() const;
- virtual bool
- hasChildNodes();
+ virtual XalanDocument*
+ getOwnerDocument() const;
- virtual NodeImpl*
- insertBefore(
- NodeImpl* newChild,
- NodeImpl* refChild);
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XalanNode*
+#else
+ virtual ResultTreeFrag*
+#endif
+ cloneNode(bool deep) const;
- virtual NodeImpl*
- removeChild(NodeImpl* oldChild);
+ virtual XalanNode*
+ insertBefore(
+ XalanNode* newChild,
+ XalanNode* refChild);
- virtual NodeImpl*
+ virtual XalanNode*
replaceChild(
- NodeImpl* newChild,
- NodeImpl* oldChild);
-
- virtual void
- setReadOnly(
- bool readOnly,
- bool deep);
-
- virtual DOMString
- toString();
+ XalanNode* newChild,
+ XalanNode* oldChild);
- // These interfaces are inherited from ResultTreeFragBase
+ virtual XalanNode*
+ removeChild(XalanNode* oldChild);
- virtual const NodeRefListBase&
- getChildNodesAsNodeRefList() const;
+ virtual XalanNode*
+ appendChild(XalanNode* newChild);
- virtual DOM_Node
- item(unsigned int index) const;
-
- virtual unsigned int
- getLength() const;
-
- virtual DOM_Node
- getFirstChild() const;
-
- virtual DOM_Node
- getLastChild() const;
+ virtual bool
+ hasChildNodes() const;
- virtual DOM_Document
- getOwnerDocument() const;
+ virtual void
+ setNodeValue(const XalanDOMString& nodeValue);
- virtual DOM_Node
- insertBefore(
- const DOM_Node& newChild,
- const DOM_Node& refChild);
+ virtual void
+ normalize();
- virtual DOM_Node
- replaceChild(
- const DOM_Node& newChild,
- const DOM_Node& oldChild);
+ virtual bool
+ supports(
+ const XalanDOMString& feature,
+ const XalanDOMString& version) const;
- virtual DOM_Node
- removeChild(const DOM_Node& oldChild);
-
- virtual DOM_Node
- appendChild(const DOM_Node& newChild);
+ virtual XalanDOMString
+ getNamespaceURI() const;
- virtual bool
- hasChildNodes() const;
+ virtual XalanDOMString
+ getPrefix() const;
- virtual DOM_Node
- cloneNode(bool deep) const;
+ virtual XalanDOMString
+ getLocalName() const;
- ResultTreeFrag&
- operator=(const ResultTreeFrag& theRHS)
- {
- if (&theRHS != this)
- {
- ResultTreeFragBase::operator==(theRHS);
+ virtual void
+ setPrefix(const XalanDOMString& prefix);
- m_document = theRHS.m_document;
- m_children = m_children;
- }
- return *this;
- }
+ // These interfaces are inherited from Cloneable...
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual Cloneable*
+#else
+ virtual ResultTreeFrag*
+#endif
+ clone(bool deep) const;
private:
@@ -242,7 +221,7 @@
operator==(const ResultTreeFrag& theRHS) const;
- DOM_Document m_document;
+ XalanDocument* m_document;
MutableNodeRefList m_children;
NodeListImplSurrogate m_surrogate;
1.3 +5 -92 xml-xalan/c/src/XPath/ResultTreeFragBase.cpp
Index: ResultTreeFragBase.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFragBase.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ResultTreeFragBase.cpp 2000/01/28 14:50:46 1.2
+++ ResultTreeFragBase.cpp 2000/04/11 14:46:11 1.3
@@ -56,112 +56,25 @@
*/
// Class header file.
#include "ResultTreeFragBase.hpp"
-#include <Include/DOMHelper.hpp>
-ResultTreeFragBase::ResultTreeFragBase(const DOM_Document&
theOwnerDocument) :
- Cloneable(),
-#if defined(XALAN_XERCES_RTTI_AVAILABLE)
-
UnimplementedDocumentFragment(dynamic_cast<DocumentImpl*>(XALAN_DOM_NodeHack(theOwnerDocument).getImplementationObject()))
-#else
-
UnimplementedDocumentFragment(static_cast<DocumentImpl*>(XALAN_DOM_NodeHack(theOwnerDocument).getImplementationObject()))
-#endif
+ResultTreeFragBase::ResultTreeFragBase() :
+ XalanDocumentFragment(),
+ Cloneable()
{
}
ResultTreeFragBase::ResultTreeFragBase(const ResultTreeFragBase&
theSource) :
- Cloneable(theSource),
- UnimplementedDocumentFragment(theSource)
+ XalanDocumentFragment(theSource),
+ Cloneable(theSource)
{
}
ResultTreeFragBase::~ResultTreeFragBase()
-{
-}
-
-
-
-DOMString
-ResultTreeFragBase::getNodeValue()
-{
- return DOMString();
-}
-
-
-
-void
-ResultTreeFragBase::setNodeValue(const DOMString&)
-{
-}
-
-
-
-DOMString
-ResultTreeFragBase::getNodeName()
-{
- return DOMString();
-}
-
-
-
-short
-ResultTreeFragBase::getNodeType()
-{
- return DocumentFragmentImpl::getNodeType();
-}
-
-
-
-NodeImpl*
-ResultTreeFragBase::getParentNode()
-{
- return 0;
-}
-
-
-
-NodeImpl*
-ResultTreeFragBase::getNextSibling()
-{
- return 0;
-}
-
-
-
-NodeImpl*
-ResultTreeFragBase::getPreviousSibling()
-{
- return 0;
-}
-
-
-
-DOM_ResultTreeFragBase::DOM_ResultTreeFragBase(ResultTreeFragBase*
theFragment) :
- DOM_UnimplementedDocumentFragment(theFragment)
-{
-}
-
-
-
-DOM_ResultTreeFragBase::DOM_ResultTreeFragBase() :
- DOM_UnimplementedDocumentFragment()
-{
-}
-
-
-
-DOM_ResultTreeFragBase::DOM_ResultTreeFragBase(const DOM_ResultTreeFragBase&
theDocument) :
- DOM_UnimplementedDocumentFragment(theDocument)
-{
-}
-
-
-
-DOM_ResultTreeFragBase::~DOM_ResultTreeFragBase()
{
}
1.6 +59 -374 xml-xalan/c/src/XPath/ResultTreeFragBase.hpp
Index: ResultTreeFragBase.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFragBase.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ResultTreeFragBase.hpp 2000/03/03 19:00:18 1.5
+++ ResultTreeFragBase.hpp 2000/04/11 14:46:11 1.6
@@ -64,27 +64,24 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_NamedNodeMap.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDocumentFragment.hpp>
#include <PlatformSupport/Cloneable.hpp>
-#include <DOMSupport/UnimplementedDocumentFragment.hpp>
-class DOM_Document;
class NodeRefListBase;
class XMLParserLiaison;
+class XalanDocument;
/**
* The holder of result tree fragments.
*/
-class XALAN_XPATH_EXPORT ResultTreeFragBase : public
UnimplementedDocumentFragment, public Cloneable
+class XALAN_XPATH_EXPORT ResultTreeFragBase : public XalanDocumentFragment,
public Cloneable
{
public:
@@ -93,309 +90,103 @@
*
* @param theOwnerDocument document used to construct result tree
fragment
*/
- ResultTreeFragBase(const DOM_Document& theOwnerDocument);
+ ResultTreeFragBase();
/**
* Construct a result tree fragment object from another.
*
* @param theSource source to copy
*/
- ResultTreeFragBase(const ResultTreeFragBase& theSource);
+ ResultTreeFragBase(const ResultTreeFragBase& theSource);
virtual
~ResultTreeFragBase();
- // Many of these interfaces duplicate ones that are inherited from the
- // Xerces DOM implementation classes. In general, they take and/or
return
- // instances of the Xerces smart-pointer classes. Other are const,
which
- // many of the Xerces functions are not.
- /**
- * A <code>NodeList</code> that contains all children of this node. If
there
- * are no children, this is a <code>NodeList</code> containing no
nodes.
- * The content of the returned <code>NodeList</code> is "live" in the
sense
- * that, for instance, changes to the children of the node object that
- * it was created from are immediately reflected in the nodes returned
by
- * the <code>NodeList</code> accessors; it is not a static snapshot of
the
- * content of the node. This is true for every <code>NodeList</code>,
- * including the ones returned by the <code>getElementsByTagName</code>
- * method.
- *
- * @return node list
- */
- virtual const NodeRefListBase&
- getChildNodesAsNodeRefList() const = 0;
+ // These interfaces are inherited from XalanDocumentFragment...
+ virtual XalanDOMString
+ getNodeName() const = 0;
- /**
- * Returns the <code>index</code>th item in the collection. If
- * <code>index</code> is greater than or equal to the number of nodes in
- * the list, this returns <code>null</code>.
- *
- * @param index index into the collection
- * @return node at the <code>index</code>th position in the
- * <code>NodeList</code>, or <code>null</code> if that is not a
- * valid index
- */
- virtual DOM_Node
- item(unsigned int index) const = 0;
+ virtual XalanDOMString
+ getNodeValue() const = 0;
- /**
- * Determine the number of nodes in the list. The range of valid child
node
- * indices is 0 to <code>length-1</code> inclusive.
- *
- * @return number of nodes
- */
- virtual unsigned int
- getLength() const = 0;
+ virtual NodeType
+ getNodeType() const = 0;
- /**
- * The first child of this node. If there is no such node, this returns
- * <code>null</code>.
- *
- * @return first child node of this node
- */
- virtual DOM_Node
- getFirstChild() const = 0;
-
- /**
- * The last child of this node. If there is no such node, this returns
- * <code>null</code>.
- *
- * @return last child node
- */
- virtual DOM_Node
- getLastChild() const = 0;
-
- /**
- * The <code>Document</code> object associated with this node. This is
- * also the <code>Document</code> object used to create new nodes. When
- * this node is a <code>Document</code> or a <code>DocumentType</code>
- * which is not used with any <code>Document</code> yet, this is
- * <code>null</code>.
- *
- * @return owner document
- */
- virtual DOM_Document
- getOwnerDocument() const = 0;
-
- /**
- * Inserts the node <code>newChild</code> before the existing child
node
- * <code>refChild</code>. If <code>refChild</code> is
<code>null</code>,
- * insert <code>newChild</code> at the end of the list of children.
- * <br>If <code>newChild</code> is a <code>DocumentFragment</code>
object,
- * all of its children are inserted, in the same order, before
- * <code>refChild</code>. If the <code>newChild</code> is already in
the
- * tree, it is first removed.
- *
- * @param newChild node to insert
- * @param refChild reference node, i.e., the node before which the new
- * node must be inserted
- * @return node being inserted
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does
not
- * allow children of the type of the <code>newChild</code> node, or
if
- * the node to insert is one of this node's ancestors
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was
created
- * from a different document than the one that created this node
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
- * <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child
of
- * this node
- */
- virtual DOM_Node
- insertBefore(
- const DOM_Node& newChild,
- const DOM_Node& refChild) = 0;
-
- /**
- * Replaces the child node <code>oldChild</code> with
<code>newChild</code>
- * in the list of children, and returns the <code>oldChild</code> node.
If
- * the <code>newChild</code> is already in the tree, it is first
removed.
- *
- * @param newChild new node to put in the child list
- * @param oldChild node being replaced in the list
- * @return node replaced
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does
not
- * allow children of the type of the <code>newChild</code> node, or
it
- * the node to put in is one of this node's ancestors
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was
created
- * from a different document than the one that created this node
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
- * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child
of
- * this node
- */
- virtual DOM_Node
- replaceChild(
- const DOM_Node& newChild,
- const DOM_Node& oldChild) = 0;
-
- /**
- * Removes the child node indicated by <code>oldChild</code> from the
list
- * of children, and returns it.
- *
- * @param oldChild node being removed
- * @return node removed
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
- * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child
of
- * this node
- */
- virtual DOM_Node
- removeChild(const DOM_Node& oldChild) = 0;
-
- /**
- * Adds the node <code>newChild</code> to the end of the list of
children of
- * this node. If the <code>newChild</code> is already in the tree, it
is
- * first removed.
- *
- * @param newChild node to add, if it is a
<code>DocumentFragment</code>
- * object, the entire contents of the document fragment are moved
into
- * the child list of this node
- * @return node added
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does
not
- * allow children of the type of the <code>newChild</code> node, or
if
- * the node to append is one of this node's ancestors
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was
created
- * from a different document than the one that created this node
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly
- */
- virtual DOM_Node
- appendChild(const DOM_Node& newChild) = 0;
+ virtual XalanNode*
+ getParentNode() const = 0;
- /**
- * Convenience method to allow easy determination of whether a node has
any
- * children.
- *
- * @return <code>true</code> if the node has any children,
- * <code>false</code> if the node has no children
- */
- virtual bool
- hasChildNodes() const = 0;
+ virtual const XalanNodeList*
+ getChildNodes() const = 0;
- /**
- * Returns a duplicate of this node, i.e., serves as a generic copy
- * constructor for nodes. The duplicate node has no parent (
- * <code>parentNode</code> returns <code>null</code>.).
- * <br>Cloning an <code>Element</code> copies all attributes and their
- * values, including those generated by the XML processor to represent
- * defaulted attributes, but this method does not copy any text it
contains
- * unless it is a deep clone, since the text is contained in a child
- * <code>Text</code> node. Cloning any other type of node simply
returns a
- * copy of this node.
- *
- * @param deep if <code>true</code>, recursively clone the subtree
under the
- * specified node; if <code>false</code>, clone only the node itself
(and
- * its attributes, if it is an <code>Element</code>)
- * @return The duplicate node.
- */
- virtual DOM_Node
- cloneNode(bool deep) const = 0;
+ virtual XalanNode*
+ getFirstChild() const = 0;
- // These interfaces are inherited from UnimplementedDocumentFragment...
+ virtual XalanNode*
+ getLastChild() const = 0;
- // These interfaces are inherited from NodeListImpl...
+ virtual XalanNode*
+ getPreviousSibling() const = 0;
- virtual NodeImpl*
- item(unsigned int index) = 0;
+ virtual XalanNode*
+ getNextSibling() const = 0;
- virtual unsigned int
- getLength() = 0;
+ virtual const XalanNamedNodeMap*
+ getAttributes() const = 0;
- // These interfaces are inherited from NodeImpl...
+ virtual XalanDocument*
+ getOwnerDocument() const = 0;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
- virtual NodeImpl*
+ virtual XalanNode*
#else
virtual ResultTreeFragBase*
#endif
- cloneNode(bool deep) = 0;
-
- virtual NodeImpl*
- appendChild(NodeImpl* newChild) = 0;
-
- virtual void
- changed() = 0;
-
- virtual NamedNodeMapImpl*
- getAttributes() = 0;
-
- virtual NodeListImpl*
- getChildNodes() = 0;
+ cloneNode(bool deep) const = 0;
- virtual NodeImpl*
- getFirstChild() = 0;
-
- virtual NodeImpl*
- getLastChild() = 0;
-
- // Deriving classes do not need to override these next three
- // interfaces, since ResultTreeFragments do not have these
- // properties.
-
- virtual DOMString
- getNodeName();
-
- virtual short
- getNodeType();
-
- virtual DOMString
- getNodeValue();
-
- // Deriving classes must implement these interfaces ...
-
- virtual DocumentImpl*
- getOwnerDocument() = 0;
-
- // Deriving classes do not need to override these next three
- // interfaces, since ResultTreeFragments do not have these
- // properties.
-
- virtual NodeImpl*
- getParentNode();
+ virtual XalanNode*
+ insertBefore(
+ XalanNode* newChild,
+ XalanNode* refChild) = 0;
- virtual NodeImpl*
- getNextSibling();
+ virtual XalanNode*
+ replaceChild(
+ XalanNode* newChild,
+ XalanNode* oldChild) = 0;
- virtual NodeImpl*
- getPreviousSibling();
+ virtual XalanNode*
+ removeChild(XalanNode* oldChild) = 0;
- // Deriving classes must implement these interfaces ...
+ virtual XalanNode*
+ appendChild(XalanNode* newChild) = 0;
virtual bool
- hasChildNodes() = 0;
+ hasChildNodes() const = 0;
- virtual NodeImpl*
- insertBefore(
- NodeImpl* newChild,
- NodeImpl* refChild) = 0;
+ virtual void
+ setNodeValue(const XalanDOMString& nodeValue) = 0;
- virtual NodeImpl*
- removeChild(NodeImpl *oldChild) = 0;
+ virtual void
+ normalize() = 0;
- virtual NodeImpl*
- replaceChild(
- NodeImpl* newChild,
- NodeImpl* oldChild) = 0;
+ virtual bool
+ supports(
+ const XalanDOMString& feature,
+ const XalanDOMString& version) const = 0;
- // Deriving classes do not need to override this, since
- // ResultTreeFragments do not have this properties.
+ virtual XalanDOMString
+ getNamespaceURI() const = 0;
- virtual void
- setNodeValue(const DOMString& value);
+ virtual XalanDOMString
+ getPrefix() const = 0;
- // Deriving classes must implement these interfaces ...
+ virtual XalanDOMString
+ getLocalName() const = 0;
virtual void
- setReadOnly(
- bool readOnly,
- bool deep) = 0;
+ setPrefix(const XalanDOMString& prefix) = 0;
- virtual DOMString
- toString() = 0;
- // These interfaces are inherited from Cloneable...
-
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Cloneable*
#else
@@ -410,7 +201,7 @@
{
Cloneable::operator=(theRHS);
- UnimplementedDocumentFragment::operator=(theRHS);
+ XalanDocumentFragment::operator=(theRHS);
return *this;
}
@@ -419,112 +210,6 @@
operator==(const ResultTreeFragBase&) const
{
return true;
- }
-};
-
-
-
-/**
- * The holder of result tree fragments, derived from Xerces DOM.
- */
-class XALAN_XPATH_EXPORT DOM_ResultTreeFragBase : public
DOM_UnimplementedDocumentFragment
-{
-public:
-
- /**
- * Constructors.
- */
- DOM_ResultTreeFragBase(ResultTreeFragBase* theFragment);
-
- DOM_ResultTreeFragBase();
-
- DOM_ResultTreeFragBase(const DOM_ResultTreeFragBase& theNode);
-
- /**
- * Destructor.
- */
- ~DOM_ResultTreeFragBase();
-
- /**
- * Assignment operator.
- *
- * @param other The source to be assigned.
- */
- DOM_ResultTreeFragBase&
- operator=(const DOM_ResultTreeFragBase& other)
- {
- DOM_UnimplementedDocumentFragment::operator=(other);
-
- return *this;
- }
-
- /**
- * Assignment operator. This overloaded variant is provided for the
sole
- * purpose of setting a DOM_Node reference variable to zero. Nulling
out
- * a reference variable in this way will decrement the reference count
on
- * the underlying Node object that the variable formerly referenced.
This
- * effect is normally obtained when reference variable goes out of
scope,
- * but zeroing them can be useful for global instances, or for local
- * instances that will remain in scope for an extended time, when the
- * storage belonging to the underlying node needs to be reclaimed.
- *
- * @param val. Only a value of 0, or null, is allowed.
- */
- DOM_ResultTreeFragBase&
- operator=(const DOM_NullPtr* val)
- {
- DOM_UnimplementedDocumentFragment::operator=(val);
-
- return *this;
- }
-
- /**
- * The equality operator. This compares to references to nodes, and
- * returns true if they both refer to the same underlying node. It
- * is exactly analogous to Java's operator == on object reference
- * variables. This operator can not be used to compare the values
- * of two different nodes in the document tree.
- *
- * @param other The object reference with which <code>this</code>
object is compared
- * @returns True if both <code>DOM_Node</code>s refer to the same
- * actual node, or are both null; return false otherwise.
- */
- bool
- operator==(const DOM_Node& other) const
- {
- return DOM_UnimplementedDocumentFragment::operator==(other);
- }
-
- /**
- * Compare with a pointer. Intended only to allow a convenient
- * comparison with null.
- *
- */
- bool
- operator==(const DOM_NullPtr* other) const
- {
- return DOM_UnimplementedDocumentFragment::operator==(other);
- }
-
- /**
- * The inequality operator. See operator ==.
- *
- */
- bool
- operator!=(const DOM_Node& other) const
- {
- return DOM_UnimplementedDocumentFragment::operator!=(other);
- }
-
- /**
- * Compare with a pointer. Intended only to allow a convenient
- * comparison with null.
- *
- */
- bool
- operator!=(const DOM_NullPtr* other) const
- {
- return DOM_UnimplementedDocumentFragment::operator!=(other);
}
};
1.5 +187 -163 xml-xalan/c/src/XPath/SimpleNodeLocator.cpp
Index: SimpleNodeLocator.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/SimpleNodeLocator.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SimpleNodeLocator.cpp 2000/02/18 22:19:23 1.4
+++ SimpleNodeLocator.cpp 2000/04/11 14:46:11 1.5
@@ -10,33 +10,33 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
@@ -59,14 +59,14 @@
-#include <Include/DOMHelper.hpp>
#include <PlatformSupport/DirectoryEnumerator.hpp>
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Attr.hpp>
-#include <dom/DOM_Document.hpp>
+#include <XalanDOM/XalanElement.hpp>
+#include <XalanDOM/XalanNamedNodeMap.hpp>
+#include <XalanDOM/XalanNode.hpp>
+#include <XalanDOM/XalanDocument.hpp>
@@ -107,7 +107,7 @@
SimpleNodeLocator::connectToNodes(
const XPath& xpath,
XPathExecutionContext&
executionContext,
- const DOM_Node& /*
context */,
+ XalanNode&
/* context */,
int
opPos,
const ConnectArgsVectorType& connectArgs)
{
@@ -116,32 +116,35 @@
const XPathExpression& currentExpression =
xpath.getExpression();
- XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+ XObjectFactory& theFactory =
+ executionContext.getXObjectFactory();
- XObjectGuard results(theFactory,
-
theFactory.createNodeSet(MutableNodeRefList()));
+ XObjectGuard results(theFactory,
+
theFactory.createNodeSet(MutableNodeRefList()));
- const DOMString theFileSpec = connectArgs[0]->str();
+ const XalanDOMString theFileSpec = connectArgs[0]->str();
- const DOMString filterSpec = connectArgs.size() > 1 ?
connectArgs[0]->str() : "";
- const int filterSpecLength = length(filterSpec);
+ const XalanDOMString filterSpec = connectArgs.size() > 1 ?
connectArgs[0]->str() : XalanDOMString();
+ const unsigned int filterSpecLength = length(filterSpec);
-#if !defined(XALAN_NO_NAMESPACES)
- using std::vector;
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<XalanDOMString> DOMStringVectorType;
+#else
+ typedef std::vector<XalanDOMString> DOMStringVectorType;
#endif
- DirectoryEnumeratorFunctor<vector<DOMString> > theEnumerator;
+ DirectoryEnumeratorFunctor<DOMStringVectorType> theEnumerator;
- const vector<DOMString> theFiles = theEnumerator(theFileSpec);
+ const DOMStringVectorType
theFiles = theEnumerator(theFileSpec);
- const int nFiles =
theFiles.size();
+ const DOMStringVectorType::size_type nFiles
= theFiles.size();
if (nFiles > 0)
{
MutableNodeRefList& theNodeList = results->mutableNodeset();
- for(int i = 0; i < nFiles; ++i)
+ for(DOMStringVectorType::size_type i = 0; i < nFiles; ++i)
{
try
{
@@ -150,7 +153,7 @@
if (filterSpecLength == 0 ||
endsWith(theFiles[i], filterSpec) ==
true)
{
- DOM_Document doc =
executionContext.parseXML(theFiles[i], theFileSpec);
+ XalanDocument* const doc =
executionContext.parseXML(theFiles[i], theFileSpec);
if(0 != doc)
{
@@ -179,7 +182,7 @@
}
catch(...)
{
- executionContext.warn(DOMString("Couldn't parse
XML file: ") + theFiles[i]);
+ executionContext.warn(XalanDOMString("Couldn't
parse XML file: ") + theFiles[i]);
}
}
}
@@ -197,12 +200,12 @@
SimpleNodeLocator::locationPath(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode& context,
int opPos)
{
MutableNodeRefList
mnl(executionContext.createMutableNodeRefList());
- step(xpath, executionContext, context, opPos + 2, mnl);
+ step(xpath, executionContext, &context, opPos + 2, mnl);
return executionContext.getXObjectFactory().createNodeSet(mnl);
}
@@ -213,12 +216,12 @@
SimpleNodeLocator::locationPathPattern(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode& context,
int opPos)
{
double score = xpath.s_MatchScoreNone;
- stepPattern(xpath, executionContext, context, opPos + 2, score);
+ stepPattern(xpath, executionContext, &context, opPos + 2, score);
return score;
}
@@ -229,9 +232,9 @@
SimpleNodeLocator::step(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
- MutableNodeRefList& queryResults)
+ MutableNodeRefList& queryResults)
{
const XPathExpression& currentExpression =
xpath.getExpression();
@@ -357,11 +360,11 @@
if(XPathExpression::eENDOP != nextStepType &&
continueStepRecursion == true)
{
- const int nContexts = subQueryResults.getLength();
+ const unsigned int nContexts =
subQueryResults.getLength();
- for(int i = 0; i < nContexts; i++)
+ for(unsigned int i = 0; i < nContexts; i++)
{
- const DOM_Node node = subQueryResults.item(i);
+ XalanNode* const node =
subQueryResults.item(i);
if(0 != node)
{
@@ -407,11 +410,11 @@
-DOM_Node
+XalanNode*
SimpleNodeLocator:: stepPattern(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
double& score)
{
@@ -422,9 +425,9 @@
const int stepType = currentExpression.getOpCodeMapValue(opPos);
const int endStep =
currentExpression.getNextOpCodePosition(opPos);
- int nextStepType =
currentExpression.getOpCodeMapValue(endStep);
+ int nextStepType =
currentExpression.getOpCodeMapValue(endStep);
- DOM_Node localContext(context);
+ XalanNode* localContext = context;
if(XPathExpression::eENDOP != nextStepType)
{
@@ -440,20 +443,22 @@
score = xpath.s_MatchScoreNone;
// !!!!!!!!!!!!! Big ugly return here
!!!!!!!!!!!!!!!!!!!
- return DOM_Node();
+ return 0;
}
score = xpath.s_MatchScoreOther;
- localContext = executionContext.getParentOfNode(localContext);
+ localContext = executionContext.getParentOfNode(*localContext);
if(0 == localContext)
{
// !!!!!!!!!!!!! Big ugly return here
!!!!!!!!!!!!!!!!!!!
- return DOM_Node();
+ return 0;
}
}
+ assert(localContext != 0);
+
int argLen = 0;
switch(stepType)
@@ -462,17 +467,17 @@
{
argLen = currentExpression.getOpCodeLength(opPos);
- const XObject* const obj =
xpath.execute(localContext, opPos, executionContext);
+ const XObject* const obj =
xpath.executeMore(localContext, opPos, executionContext);
const NodeRefListBase& nl = obj->nodeset();
- const int len =
nl.getLength();
+ const unsigned int len = nl.getLength();
score = xpath.s_MatchScoreNone;
- for(int i = 0; i < len; i++)
+ for(unsigned int i = 0; i < len; i++)
{
- const DOM_Node n = nl.item(i);
+ XalanNode* const n = nl.item(i);
score = n == localContext ?
xpath.s_MatchScoreOther :
xpath.s_MatchScoreNone;
@@ -496,9 +501,9 @@
opPos += 3;
- const DOM_Document docContext =
DOM_Node::DOCUMENT_NODE == localContext.getNodeType() ?
-
static_cast<const DOM_Document&>(localContext) :
-
localContext.getOwnerDocument();
+ XalanNode* const docContext =
+ XalanNode::DOCUMENT_NODE ==
localContext->getNodeType() ?
+ localContext :
localContext->getOwnerDocument();
score = docContext == localContext ?
xpath.s_MatchScoreOther : xpath.s_MatchScoreNone;
@@ -546,7 +551,7 @@
if(xpath.s_MatchScoreNone != score)
break;
- localContext =
executionContext.getParentOfNode(localContext);
+ localContext =
executionContext.getParentOfNode(*localContext);
}
}
break;
@@ -626,10 +631,10 @@
// easiest way.
executionContext.setThrowFoundIndex(false);
- const DOM_Node parentContext =
- executionContext.getParentOfNode(localContext);
+ XalanNode* const parentContext =
+ executionContext.getParentOfNode(*localContext);
- MutableNodeRefList
mnl(executionContext.createMutableNodeRefList());
+ MutableNodeRefList
mnl(executionContext.createMutableNodeRefList());
step(xpath, executionContext, parentContext,
startOpPos, mnl);
@@ -649,7 +654,7 @@
}
}
- return score == xpath.s_MatchScoreNone ? DOM_Node() : localContext;
+ return score == xpath.s_MatchScoreNone ? 0 : localContext;
}
@@ -658,7 +663,7 @@
SimpleNodeLocator::findNodeSet(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int /* stepType */,
MutableNodeRefList& subQueryResults)
@@ -666,7 +671,7 @@
const XPathExpression& currentExpression =
xpath.getExpression();
- const XObject* const obj = xpath.execute(context, opPos,
executionContext);
+ const XObject* const obj = xpath.executeMore(context, opPos,
executionContext);
const NodeRefListBase& nl = obj->nodeset();
@@ -686,7 +691,7 @@
SimpleNodeLocator::findRoot(
const XPath& xpath,
XPathExecutionContext& /* executionContext */,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int /* stepType */,
MutableNodeRefList& subQueryResults)
@@ -699,9 +704,10 @@
const int argLen =
currentExpression.getOpCodeMapValue(opPos +
XPathExpression::s__opCodeMapLengthIndex + 1) - 3;
- DOM_Document docContext = DOM_Node::DOCUMENT_NODE ==
context.getNodeType() ?
-
static_cast<const DOM_Document&>(context) :
-
context.getOwnerDocument();
+ XalanNode* const docContext = XalanNode::DOCUMENT_NODE ==
context->getNodeType() ?
+ context
:
+
context->getOwnerDocument();
+ assert(docContext != 0);
subQueryResults.addNode(docContext);
@@ -714,7 +720,7 @@
SimpleNodeLocator::findParent(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -729,7 +735,7 @@
opPos += 3;
- const DOM_Node theParent = executionContext.getParentOfNode(context);
+ XalanNode* const theParent =
executionContext.getParentOfNode(*context);
if(0 != theParent)
{
@@ -762,7 +768,7 @@
SimpleNodeLocator::findSelf(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -805,7 +811,7 @@
SimpleNodeLocator::findAncestors(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -813,8 +819,8 @@
const XPathExpression& currentExpression =
xpath.getExpression();
- DOM_Node contextNode =
- executionContext.getParentOfNode(context);
+ XalanNode* contextNode =
+ executionContext.getParentOfNode(*context);
// $$ ToDO: Can we reduce this to some call on the
// XPathExpression interface?
@@ -837,7 +843,7 @@
subQueryResults.addNode(contextNode);
}
- contextNode = executionContext.getParentOfNode(contextNode);
+ contextNode = executionContext.getParentOfNode(*contextNode);
}
return argLen + 3;
@@ -849,7 +855,7 @@
SimpleNodeLocator::findAncestorsOrSelf(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -860,7 +866,7 @@
const XPathExpression& currentExpression =
xpath.getExpression();
- DOM_Node contextNode(context);
+ XalanNode* contextNode = context;
// $$ ToDO: Can we reduce this to some call on the
// XPathExpression interface?
@@ -883,7 +889,7 @@
subQueryResults.addNode(contextNode);
}
- contextNode = executionContext.getParentOfNode(contextNode);
+ contextNode = executionContext.getParentOfNode(*contextNode);
}
return argLen + 3;
@@ -895,7 +901,7 @@
SimpleNodeLocator::findAttributes(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -908,23 +914,23 @@
const int argLen =
currentExpression.getOpCodeMapValue(opPos +
XPathExpression::s__opCodeMapLengthIndex + 1) - 3;
- if(0 != context && context.getNodeType() == DOM_Node::ELEMENT_NODE)
+ if(0 != context && context->getNodeType() == XalanNode::ELEMENT_NODE)
{
- const DOM_Element& e =
- static_cast<const DOM_Element&>(context);
+ const XalanElement* const e =
+ static_cast<const XalanElement*>(context);
- DOM_NamedNodeMap attributeList = e.getAttributes();
+ const XalanNamedNodeMap* const attributeList =
e->getAttributes();
if(attributeList != 0)
{
opPos += 3;
- const int nAttrs = attributeList.getLength();
+ const unsigned int nAttrs =
attributeList->getLength();
- for(int j = 0; j < nAttrs; j++)
+ for(unsigned int j = 0; j < nAttrs; j++)
{
- const DOM_Node theNode = attributeList.item(j);
- assert(theNode.getNodeType() ==
DOM_Node::ATTRIBUTE_NODE);
+ XalanNode* const theNode =
attributeList->item(j);
+ assert(theNode != 0 && theNode->getNodeType()
== XalanNode::ATTRIBUTE_NODE);
const double score = nodeTest(xpath,
executionContext,
@@ -950,7 +956,7 @@
SimpleNodeLocator::findChildren(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -965,7 +971,7 @@
opPos += 3;
- DOM_Node child = context.getFirstChild();
+ XalanNode* child = context->getFirstChild();
while(0 != child)
{
@@ -981,7 +987,7 @@
subQueryResults.addNode(child);
}
- child = child.getNextSibling();
+ child = child->getNextSibling();
}
return argLen + 3;
@@ -993,7 +999,7 @@
SimpleNodeLocator::findDescendants(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -1020,7 +1026,7 @@
|| (Node.ELEMENT_NODE != context.getNodeType()))
{
*/
- DOM_Node pos = context;
+ XalanNode* pos = context;
while(0 != pos)
{
@@ -1040,18 +1046,18 @@
}
}
- DOM_Node nextNode = pos.getFirstChild();
+ XalanNode* nextNode = pos->getFirstChild();
while(0 == nextNode)
{
if(context == pos)
break;
- nextNode = pos.getNextSibling();
+ nextNode = pos->getNextSibling();
if(0 == nextNode)
{
- pos = pos.getParentNode();
+ pos = pos->getParentNode();
if(context == pos || pos == 0)
{
@@ -1073,7 +1079,7 @@
SimpleNodeLocator::findFollowing(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -1089,13 +1095,13 @@
opPos += 3;
// What fun...
- const DOM_Document doc = context.getOwnerDocument();
+ XalanDocument* const doc = context->getOwnerDocument();
- DOM_Node pos = context;
+ XalanNode* pos = context;
while(0 != pos)
{
- DOM_Node nextNode;
+ XalanNode* nextNode = 0;
if(pos != context)
{
@@ -1111,7 +1117,7 @@
subQueryResults.addNodeInDocOrder(pos);
}
- nextNode = pos.getFirstChild();
+ nextNode = pos->getFirstChild();
}
else
{
@@ -1120,11 +1126,11 @@
while(0 == nextNode)
{
- nextNode = pos.getNextSibling();
+ nextNode = pos->getNextSibling();
if(0 == nextNode)
{
- pos = pos.getParentNode();
+ pos = pos->getParentNode();
if(doc == pos || 0 == pos)
{
@@ -1147,7 +1153,7 @@
SimpleNodeLocator::findFollowingSiblings(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -1162,7 +1168,7 @@
opPos += 3;
- DOM_Node pos = context.getNextSibling();
+ XalanNode* pos = context->getNextSibling();
while(0 != pos)
{
@@ -1178,7 +1184,7 @@
subQueryResults.addNode(pos);
}
- pos = pos.getNextSibling();
+ pos = pos->getNextSibling();
}
return argLen + 3;
@@ -1190,7 +1196,7 @@
SimpleNodeLocator::findPreceeding(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -1206,9 +1212,9 @@
opPos += 3;
// Ugh. Reverse document order, no parents, I guess.
- const DOM_Document doc = context.getOwnerDocument();
+ XalanDocument* const doc = context->getOwnerDocument();
- DOM_Node pos = doc;
+ XalanNode* pos = doc;
while(0 != pos)
{
@@ -1228,7 +1234,7 @@
// sure there's a better way to check for the parent.
bool isParent = false;
- DOM_Node parent =
executionContext.getParentOfNode(context);
+ XalanNode* parent =
executionContext.getParentOfNode(*context);
while(0 != parent)
{
@@ -1238,7 +1244,7 @@
break;
}
- parent =
executionContext.getParentOfNode(parent);
+ parent =
executionContext.getParentOfNode(*parent);
}
if(isParent == false)
@@ -1247,15 +1253,15 @@
}
}
- DOM_Node nextNode = pos.getFirstChild();
+ XalanNode* nextNode = pos->getFirstChild();
while(0 == nextNode)
{
- nextNode = pos.getNextSibling();
+ nextNode = pos->getNextSibling();
if(0 == nextNode)
{
- pos = pos.getParentNode();
+ pos = pos->getParentNode();
if(doc == pos)
{
@@ -1276,7 +1282,7 @@
SimpleNodeLocator::findPreceedingSiblings(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults)
@@ -1291,7 +1297,7 @@
opPos += 3;
- DOM_Node pos = context.getPreviousSibling();
+ XalanNode* pos = context->getPreviousSibling();
while(0 != pos)
{
@@ -1307,7 +1313,7 @@
subQueryResults.addNode(pos);
}
- pos = pos.getPreviousSibling();
+ pos = pos->getPreviousSibling();
}
return argLen + 3;
@@ -1319,10 +1325,10 @@
SimpleNodeLocator::findNamespace(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
- int /* stepType */,
- MutableNodeRefList& /* subQueryResults */)
+ int stepType,
+ MutableNodeRefList& subQueryResults)
{
const XPathExpression& currentExpression =
xpath.getExpression();
@@ -1331,9 +1337,34 @@
// XPathExpression interface?
const int argLen =
currentExpression.getOpCodeMapValue(opPos +
XPathExpression::s__opCodeMapLengthIndex + 1) - 3;
+
+ if(context != 0 && context->getNodeType() == XalanNode::ELEMENT_NODE)
+ {
+ const XalanNamedNodeMap* const attributeList =
+ context->getAttributes();
+
+ if(attributeList != 0)
+ {
+ const unsigned int nAttrs =
attributeList->getLength();
- executionContext.error("namespace axis not implemented yet!", context);
+ for(unsigned int i = 0; i < nAttrs; ++i)
+ {
+ XalanNode* const attr =
attributeList->item(i);
+ if(nodeTest(xpath,
+ executionContext,
+ attr,
+ opPos,
+ argLen,
+ stepType) !=
xpath.s_MatchScoreNone)
+ {
+ subQueryResults.addNode(attr);
+ // If we have an attribute name here,
we can quit.
+ }
+ }
+ }
+ }
+
return argLen + 3;
}
@@ -1343,7 +1374,7 @@
SimpleNodeLocator::findNodesOnUnknownAxis(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& /* subQueryResults */)
@@ -1367,7 +1398,7 @@
SimpleNodeLocator::nodeTest(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int argLen,
int stepType)
@@ -1379,26 +1410,26 @@
const int testType = currentExpression.getOpCodeMapValue(opPos);
- const int nodeType = context.getNodeType();
+ const int nodeType = context->getNodeType();
opPos++;
switch(testType)
{
case XPathExpression::eNODETYPE_COMMENT:
- score = DOM_Node::COMMENT_NODE == nodeType
+ score = XalanNode::COMMENT_NODE == nodeType
? xpath.s_MatchScoreNodeTest : xpath.s_MatchScoreNone;
break;
case XPathExpression::eNODETYPE_TEXT:
- score = (DOM_Node::CDATA_SECTION_NODE == nodeType ||
- DOM_Node::TEXT_NODE == nodeType) &&
- executionContext.shouldStripSourceNode(context) ==
false
+ score = (XalanNode::CDATA_SECTION_NODE == nodeType ||
+ XalanNode::TEXT_NODE == nodeType) &&
+ executionContext.shouldStripSourceNode(*context) ==
false
? xpath.s_MatchScoreNodeTest : xpath.s_MatchScoreNone;
break;
case XPathExpression::eNODETYPE_PI:
- if(DOM_Node::PROCESSING_INSTRUCTION_NODE != nodeType)
+ if(XalanNode::PROCESSING_INSTRUCTION_NODE != nodeType)
{
score = xpath.s_MatchScoreNone;
}
@@ -1416,11 +1447,8 @@
const XObject* const name =
currentExpression.getToken(tokenPosition);
assert(name != 0);
-
- const DOM_ProcessingInstruction& theNode
=
- reinterpret_cast<const
DOM_ProcessingInstruction&>(context);
- score = equals(theNode.getNodeName(),
name->str())
+ score = equals(context->getNodeName(),
name->str())
? xpath.s_MatchScoreQName :
xpath.s_MatchScoreNone;
}
else
@@ -1434,10 +1462,10 @@
break;
case XPathExpression::eNODETYPE_NODE:
- if (nodeType == DOM_Node::CDATA_SECTION_NODE ||
- nodeType == DOM_Node::TEXT_NODE)
+ if (nodeType == XalanNode::CDATA_SECTION_NODE ||
+ nodeType == XalanNode::TEXT_NODE)
{
- if (executionContext.shouldStripSourceNode(context) ==
false)
+ if (executionContext.shouldStripSourceNode(*context) ==
false)
{
score = xpath.s_MatchScoreNodeTest;
}
@@ -1453,21 +1481,21 @@
break;
case XPathExpression::eNODETYPE_ROOT:
- score = DOM_Node::DOCUMENT_FRAGMENT_NODE == nodeType ||
- DOM_Node::DOCUMENT_NODE == nodeType ?
+ score = XalanNode::DOCUMENT_FRAGMENT_NODE == nodeType ||
+ XalanNode::DOCUMENT_NODE == nodeType ?
xpath.s_MatchScoreOther :
xpath.s_MatchScoreNone;
break;
case XPathExpression::eNODENAME:
{
- bool test = false;
+ bool test = false;
- int queueIndex =
currentExpression.getOpCodeMapValue(opPos);
+ int queueIndex =
currentExpression.getOpCodeMapValue(opPos);
- const DOMString targetNS = queueIndex >= 0 ?
+ const XalanDOMString targetNS = queueIndex >= 0 ?
currentExpression.getToken(queueIndex)->str() :
-
"";
+
XalanDOMString();
opPos++;
@@ -1493,7 +1521,7 @@
if(isTotallyWild == false && processNamespaces == true)
{
- const DOMString contextNS =
executionContext.getNamespaceOfNode(context);
+ const XalanDOMString contextNS =
executionContext.getNamespaceOfNode(*context);
if(0 != length(targetNS) && 0 !=
length(contextNS))
{
@@ -1514,8 +1542,8 @@
queueIndex = currentExpression.getOpCodeMapValue(opPos);
- const DOMString targetLocalName =
- queueIndex >= 0 ?
currentExpression.getToken(queueIndex)->str() : "";
+ const XalanDOMString targetLocalName =
+ queueIndex >= 0 ?
currentExpression.getToken(queueIndex)->str() : XalanDOMString();
if(test == false)
{
@@ -1525,21 +1553,18 @@
{
switch(nodeType)
{
- case DOM_Node::ATTRIBUTE_NODE:
+ case XalanNode::ATTRIBUTE_NODE:
if(stepType ==
XPathExpression::eFROM_ATTRIBUTES)
{
- assert(context.getNodeType() ==
DOM_Node::ATTRIBUTE_NODE);
+ assert(context->getNodeType()
== XalanNode::ATTRIBUTE_NODE);
if(XPathExpression::eELEMWILDCARD == queueIndex)
{
if(processNamespaces ==
true)
{
- const DOM_Attr&
theNode =
-
reinterpret_cast<const DOM_Attr&>(context);
+ const
XalanDOMString attrName =
+
context->getNodeName();
- const DOMString
attrName =
-
theNode.getNodeName();
-
score =
!(startsWith(attrName, "xmlns:") ||
equals(attrName, "xmlns"))
? xpath.s_MatchScoreNodeTest : xpath.s_MatchScoreNone;
@@ -1551,8 +1576,8 @@
}
else
{
- const DOMString
localAttrName =
-
executionContext.getLocalNameOfNode(context);
+ const XalanDOMString
localAttrName =
+
executionContext.getLocalNameOfNode(*context);
score =
equals(localAttrName, targetLocalName) ?
xpath.s_MatchScoreQName : xpath.s_MatchScoreNone;
@@ -1564,7 +1589,7 @@
}
break;
- case DOM_Node::ELEMENT_NODE:
+ case XalanNode::ELEMENT_NODE:
if(stepType !=
XPathExpression::eFROM_ATTRIBUTES)
{
if(XPathExpression::eELEMWILDCARD == queueIndex)
@@ -1574,10 +1599,7 @@
}
else
{
- const DOM_Element&
theNode =
-
static_cast<const DOM_Element&>(context);
-
- score =
equals(executionContext.getLocalNameOfNode(theNode), targetLocalName) ?
+ score =
equals(executionContext.getLocalNameOfNode(*context), targetLocalName) ?
xpath.s_MatchScoreQName : xpath.s_MatchScoreNone;
}
}
@@ -1610,7 +1632,7 @@
SimpleNodeLocator::predicates(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& /* context */,
+ XalanNode* /* context */,
int opPos,
MutableNodeRefList& subQueryResults,
int&
endPredicatesPos)
@@ -1628,13 +1650,13 @@
const int theLength = subQueryResults.getLength();
#if defined(XALAN_NO_NAMESPACES)
- typedef vector<int> FailedEntriesVectorType;
+ typedef vector<int> FailedEntriesVectorType;
#else
typedef std::vector<int> FailedEntriesVectorType;
#endif
// We'll accumulate the entries that we want to remove
// here, then remove them all at once.
- FailedEntriesVectorType theFailedEntries;
+ FailedEntriesVectorType theFailedEntries;
// Might as well reserve some space now, although it's
// probably bad to reserve the entire size of the
@@ -1643,9 +1665,11 @@
while(i < theLength)
{
- const DOM_Node theNode = subQueryResults.item(i);
+ XalanNode* const theNode =
subQueryResults.item(i);
+ assert(theNode != 0);
- XObject* const pred = xpath.predicate(theNode, opPos,
executionContext);
+ XObject* const pred = xpath.predicate(theNode,
opPos, executionContext);
+ assert(pred != 0);
// Remove any node that doesn't satisfy the predicate.
if(XObject::eTypeNumber == pred->getType() &&
1.6 +23 -23 xml-xalan/c/src/XPath/SimpleNodeLocator.hpp
Index: SimpleNodeLocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/SimpleNodeLocator.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SimpleNodeLocator.hpp 2000/03/03 19:00:18 1.5
+++ SimpleNodeLocator.hpp 2000/04/11 14:46:11 1.6
@@ -102,7 +102,7 @@
connectToNodes(
const XPath& xpath,
XPathExecutionContext&
executionContext,
- const DOM_Node&
context,
+ XalanNode&
context,
int
opPos,
const ConnectArgsVectorType& connectArgs);
@@ -110,14 +110,14 @@
locationPath(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode& context,
int opPos);
virtual double
locationPathPattern(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode& context,
int opPos);
protected:
@@ -126,7 +126,7 @@
step(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
MutableNodeRefList& queryResults);
@@ -138,11 +138,11 @@
* @param opPos The current position in the xpath operation map array
* @return the last matched context node
*/
- DOM_Node
+ XalanNode*
stepPattern(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
double& score);
@@ -150,7 +150,7 @@
findNodeSet(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -159,7 +159,7 @@
findRoot(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -168,7 +168,7 @@
findParent(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -177,7 +177,7 @@
findSelf(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -186,7 +186,7 @@
findAncestors(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -195,7 +195,7 @@
findAncestorsOrSelf(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -204,7 +204,7 @@
findAttributes(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -213,7 +213,7 @@
findChildren(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -222,7 +222,7 @@
findDescendants(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -231,7 +231,7 @@
findFollowing(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -240,7 +240,7 @@
findFollowingSiblings(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -249,7 +249,7 @@
findPreceeding(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -258,7 +258,7 @@
findPreceedingSiblings(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -267,7 +267,7 @@
findNamespace(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -276,7 +276,7 @@
findNodesOnUnknownAxis(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int stepType,
MutableNodeRefList& subQueryResults);
@@ -285,7 +285,7 @@
nodeTest(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int argLen,
int stepType);
@@ -294,7 +294,7 @@
predicates(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
MutableNodeRefList& subQueryResults,
int&
endPredicatesPos);
1.2 +19 -9 xml-xalan/c/src/XPath/XBoolean.cpp
Index: XBoolean.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XBoolean.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XBoolean.cpp 1999/12/18 19:47:55 1.1
+++ XBoolean.cpp 2000/04/11 14:46:11 1.2
@@ -59,6 +59,10 @@
+#include <PlatformSupport/DOMStringHelper.hpp>
+
+
+
#include "XObjectTypeCallback.hpp"
@@ -105,10 +109,10 @@
-DOMString
+XalanDOMString
XBoolean::getTypeString() const
{
- return "#BOOLEAN";
+ return XALAN_STATIC_UCODE_STRING("#BOOLEAN");
}
@@ -129,14 +133,20 @@
-DOMString
+XalanDOMString
XBoolean::str() const
{
- return m_value == true ? "true" : "false";
+ return m_value == true ? XALAN_STATIC_UCODE_STRING("true") :
+
XALAN_STATIC_UCODE_STRING("false");
}
+// dummy object for casts after throw statements.
+static int dummy;
+
+
+
const ResultTreeFragBase&
XBoolean::rtree() const
{
@@ -144,7 +154,7 @@
// error will throw, so this is just a dummy
// value to satisfy the compiler.
- return *static_cast<ResultTreeFragBase*>(0);
+ return reinterpret_cast<ResultTreeFragBase&>(dummy);
}
@@ -156,7 +166,7 @@
// error will throw, so this is just a dummy
// value to satisfy the compiler.
- return *static_cast<ResultTreeFragBase*>(0);
+ return reinterpret_cast<ResultTreeFragBase&>(dummy);
}
@@ -168,7 +178,7 @@
// error will throw, so this is just a dummy
// value to satisfy the compiler.
- return *static_cast<NodeRefListBase*>(0);
+ return reinterpret_cast<NodeRefListBase&>(dummy);
}
@@ -180,7 +190,7 @@
// error will throw, so this is just a dummy
// value to satisfy the compiler.
- return *static_cast<MutableNodeRefList*>(0);
+ return reinterpret_cast<MutableNodeRefList&>(dummy);
}
@@ -192,7 +202,7 @@
// error will throw, so this is just a dummy
// value to satisfy the compiler.
- return *static_cast<MutableNodeRefList*>(0);
+ return reinterpret_cast<MutableNodeRefList&>(dummy);
}
1.3 +2 -6 xml-xalan/c/src/XPath/XBoolean.hpp
Index: XBoolean.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XBoolean.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XBoolean.hpp 2000/03/03 19:00:19 1.2
+++ XBoolean.hpp 2000/04/11 14:46:12 1.3
@@ -69,10 +69,6 @@
-#include <dom/DOMString.hpp>
-
-
-
class XALAN_XPATH_EXPORT XBoolean : public XObject
{
public:
@@ -93,7 +89,7 @@
virtual eObjectType
getType() const;
- virtual DOMString
+ virtual XalanDOMString
getTypeString() const;
virtual double
@@ -102,7 +98,7 @@
virtual bool
boolean() const;
- virtual DOMString
+ virtual XalanDOMString
str() const;
virtual const ResultTreeFragBase&
1.2 +1 -1 xml-xalan/c/src/XPath/XBooleanStatic.cpp
Index: XBooleanStatic.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XBooleanStatic.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XBooleanStatic.cpp 1999/12/18 19:47:55 1.1
+++ XBooleanStatic.cpp 2000/04/11 14:46:12 1.2
@@ -85,7 +85,7 @@
void
-XBooleanStatic::error(const DOMString& msg) const
+XBooleanStatic::error(const XalanDOMString& msg) const
{
throw XPathException(msg);
}
1.3 +1 -5 xml-xalan/c/src/XPath/XBooleanStatic.hpp
Index: XBooleanStatic.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XBooleanStatic.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XBooleanStatic.hpp 2000/03/03 19:00:19 1.2
+++ XBooleanStatic.hpp 2000/04/11 14:46:12 1.3
@@ -69,10 +69,6 @@
-#include <dom/DOMString.hpp>
-
-
-
class XALAN_XPATH_EXPORT XBooleanStatic : public XBoolean
{
public:
@@ -94,7 +90,7 @@
// We have to override this because there is not XPathEnvSupport
// for this class, so an error always throws an exception.
virtual void
- error(const DOMString& msg) const;
+ error(const XalanDOMString& msg) const;
private:
};
1.5 +4 -4 xml-xalan/c/src/XPath/XLocator.hpp
Index: XLocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XLocator.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XLocator.hpp 2000/03/03 19:00:19 1.4
+++ XLocator.hpp 2000/04/11 14:46:12 1.5
@@ -68,7 +68,7 @@
-class DOM_Node;
+class XalanNode;
class XObject;
class XPath;
class XPathExecutionContext;
@@ -110,7 +110,7 @@
connectToNodes(
const XPath& xpath,
XPathExecutionContext&
executionContext,
- const DOM_Node&
context,
+ XalanNode&
context,
int
opPos,
const ConnectArgsVectorType& connectArgs) = 0;
@@ -129,7 +129,7 @@
locationPath(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode& context,
int opPos) = 0;
/**
@@ -145,7 +145,7 @@
locationPathPattern(
const XPath& xpath,
XPathExecutionContext& executionContext,
- const DOM_Node& context,
+ XalanNode& context,
int opPos) = 0;
};
1.3 +39 -24 xml-xalan/c/src/XPath/XNodeSet.cpp
Index: XNodeSet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNodeSet.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XNodeSet.cpp 2000/02/03 20:13:18 1.2
+++ XNodeSet.cpp 2000/04/11 14:46:13 1.3
@@ -59,8 +59,10 @@
+#include <XalanDOM/XalanNode.hpp>
+
#include <PlatformSupport/DOMStringHelper.hpp>
#include <PlatformSupport/DoubleSupport.hpp>
@@ -102,13 +104,13 @@
XNodeSet::XNodeSet(
XPathEnvSupport& envSupport,
XPathSupport& support,
- const DOM_Node& value) :
+ XalanNode& value) :
XObject(&envSupport),
m_support(support),
m_value(),
m_resultTreeFrag()
{
- m_value.addNode(value);
+ m_value.addNode(&value);
}
@@ -146,10 +148,10 @@
-DOMString
+XalanDOMString
XNodeSet::getTypeString() const
{
- return "#NODESET";
+ return XALAN_STATIC_UCODE_STRING("#NODESET");
}
@@ -161,7 +163,7 @@
if(m_value.getLength() > 0)
{
- const DOMString s =
m_support.getNodeData(m_value.item(0));
+ const XalanDOMString s =
m_support.getNodeData(*m_value.item(0));
if(0 == length(s))
{
@@ -186,25 +188,26 @@
-DOMString
+XalanDOMString
XNodeSet::str() const
{
- DOMString theResult;
+ XalanDOMString theResult;
if (m_value.getLength() > 0)
{
- const DOM_Node theNode = m_value.item(0);
+ const XalanNode* const theNode = m_value.item(0);
+ assert(theNode != 0);
- const int theType = theNode.getNodeType();
+ const XalanNode::NodeType theType =
theNode->getNodeType();
- if (theType == DOM_Node::COMMENT_NODE ||
- theType == DOM_Node::PROCESSING_INSTRUCTION_NODE)
+ if (theType == XalanNode::COMMENT_NODE ||
+ theType == XalanNode::PROCESSING_INSTRUCTION_NODE)
{
- theResult = theNode.getNodeValue();
+ theResult = theNode->getNodeValue();
}
else
{
- theResult = m_support.getNodeData(theNode);
+ theResult = m_support.getNodeData(*theNode);
}
}
@@ -213,6 +216,12 @@
+#if !defined(XALAN_NO_NAMESPACES)
+using std::auto_ptr;
+#endif
+
+
+
const ResultTreeFragBase&
XNodeSet::rtree() const
{
@@ -220,12 +229,14 @@
if (m_resultTreeFrag.get() == 0)
{
+ assert(m_envSupport->getDOMFactory() != 0);
+
ResultTreeFrag* const theFrag =
- new ResultTreeFrag(m_envSupport->getDOMFactory(),
+ new ResultTreeFrag(*m_envSupport->getDOMFactory(),
m_support);
#if defined(XALAN_OLD_AUTO_PTR)
- m_resultTreeFrag = std::auto_ptr<ResultTreeFragBase>(theFrag);
+ m_resultTreeFrag = auto_ptr<ResultTreeFragBase>(theFrag);
#else
m_resultTreeFrag.reset(theFrag);
#endif
@@ -234,7 +245,7 @@
for(int i = 0; i < nNodes; i++)
{
-
m_resultTreeFrag->appendChild(m_value.item(i).cloneNode(true));
+
m_resultTreeFrag->appendChild(m_value.item(i)->cloneNode(true));
}
}
@@ -250,12 +261,14 @@
if (m_resultTreeFrag.get() == 0)
{
+ assert(m_envSupport->getDOMFactory() != 0);
+
ResultTreeFrag* const theFrag =
- new ResultTreeFrag(m_envSupport->getDOMFactory(),
+ new ResultTreeFrag(*m_envSupport->getDOMFactory(),
m_support);
#if defined(XALAN_OLD_AUTO_PTR)
- m_resultTreeFrag = std::auto_ptr<ResultTreeFragBase>(theFrag);
+ m_resultTreeFrag = auto_ptr<ResultTreeFragBase>(theFrag);
#else
m_resultTreeFrag.reset(theFrag);
#endif
@@ -264,7 +277,7 @@
for(int i = 0; i < nNodes; i++)
{
-
m_resultTreeFrag->appendChild(m_value.item(i).cloneNode(true));
+
m_resultTreeFrag->appendChild(m_value.item(i)->cloneNode(true));
}
}
@@ -326,7 +339,8 @@
if (XObject::eTypeNodeSet == theType)
{
// See the XPath spec., section 3.4 for an explanation of this
lunacy...
- const int theLHSLength =
m_value.getLength();
+ // $$$ ToDo: This is still not correct.
+ const unsigned int theLHSLength = m_value.getLength();
if (theLHSLength > 0)
{
@@ -336,14 +350,15 @@
// See if there's at least one pair of nodes in the two
nodes sets
// whose "string" values are equal...
- for(int i = 0; i < theLHSLength && fResult == false;
i++)
+ for(unsigned int i = 0; i < theLHSLength && fResult ==
false; i++)
{
- const DOM_Node theCurrent(m_value.item(i));
+ const XalanNode* const theCurrent =
m_value.item(i);
+ assert(theCurrent != 0);
for (int j = 0; j < theRHSLength && fResult ==
false; j++)
{
- if
(::equals(m_support.getNodeData(theCurrent),
-
m_support.getNodeData(theRHSNodeSet.m_value.item(j))) == true)
+ if
(::equals(m_support.getNodeData(*theCurrent),
+
m_support.getNodeData(*theRHSNodeSet.m_value.item(j))) == true)
{
fResult = true;
}
1.3 +7 -8 xml-xalan/c/src/XPath/XNodeSet.hpp
Index: XNodeSet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNodeSet.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XNodeSet.hpp 2000/03/03 19:00:19 1.2
+++ XNodeSet.hpp 2000/04/11 14:46:13 1.3
@@ -73,11 +73,6 @@
-#include <dom/DOM_DocumentFragment.hpp>
-#include <dom/DOMString.hpp>
-
-
-
#include <XPath/ResultTreeFragBase.hpp>
#include <XPath/MutableNodeRefList.hpp>
@@ -132,7 +127,7 @@
XNodeSet(
XPathEnvSupport& envSupport,
XPathSupport& support,
- const DOM_Node& value);
+ XalanNode& value);
/**
* Create an XNodeSet from another.
@@ -152,7 +147,7 @@
virtual eObjectType
getType() const;
- virtual DOMString
+ virtual XalanDOMString
getTypeString() const;
virtual double
@@ -161,7 +156,7 @@
virtual bool
boolean() const;
- virtual DOMString
+ virtual XalanDOMString
str() const;
virtual const ResultTreeFragBase&
@@ -199,7 +194,11 @@
MutableNodeRefList
m_value;
+#if defined(XALAN_NO_NAMESPACES)
+ std::auto_ptr<ResultTreeFragBase>
m_resultTreeFrag;
+#else
mutable std::auto_ptr<ResultTreeFragBase> m_resultTreeFrag;
+#endif
};
1.2 +6 -6 xml-xalan/c/src/XPath/XNull.cpp
Index: XNull.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNull.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XNull.cpp 1999/12/18 19:47:55 1.1
+++ XNull.cpp 2000/04/11 14:46:13 1.2
@@ -69,7 +69,7 @@
XPathEnvSupport& envSupport,
XPathSupport& support) :
XObject(&envSupport),
- m_resultTreeFrag(new ResultTreeFrag(envSupport.getDOMFactory(),
+ m_resultTreeFrag(new ResultTreeFrag(*envSupport.getDOMFactory(),
support))
{
}
@@ -81,7 +81,7 @@
bool deepClone) :
XObject(source),
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
-
m_resultTreeFrag(dynamic_cast<ResultTreeFragBase*>(source.m_resultTreeFrag->clone(deepClone)))
+
m_resultTreeFrag(static_cast<ResultTreeFragBase*>(source.m_resultTreeFrag->cloneNode(deepClone)))
#else
m_resultTreeFrag(source.m_resultTreeFrag->clone(deepClone))
#endif
@@ -104,10 +104,10 @@
-DOMString
+XalanDOMString
XNull::getTypeString() const
{
- return "#NULL";
+ return XALAN_STATIC_UCODE_STRING("#NULL");
}
@@ -128,10 +128,10 @@
-DOMString
+XalanDOMString
XNull::str() const
{
- return "";
+ return XalanDOMString();
}
1.3 +3 -3 xml-xalan/c/src/XPath/XNull.hpp
Index: XNull.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNull.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XNull.hpp 2000/03/03 19:00:19 1.2
+++ XNull.hpp 2000/04/11 14:46:13 1.3
@@ -68,7 +68,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -117,7 +117,7 @@
virtual eObjectType
getType() const;
- virtual DOMString
+ virtual XalanDOMString
getTypeString() const;
virtual double
@@ -126,7 +126,7 @@
virtual bool
boolean() const;
- virtual DOMString
+ virtual XalanDOMString
str() const;
virtual const ResultTreeFragBase&
1.2 +3 -3 xml-xalan/c/src/XPath/XNumber.cpp
Index: XNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNumber.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XNumber.cpp 1999/12/18 19:47:55 1.1
+++ XNumber.cpp 2000/04/11 14:46:14 1.2
@@ -100,10 +100,10 @@
-DOMString
+XalanDOMString
XNumber::getTypeString() const
{
- return "#NUMBER";
+ return XALAN_STATIC_UCODE_STRING("#NUMBER");
}
@@ -124,7 +124,7 @@
-DOMString
+XalanDOMString
XNumber::str() const
{
return DoubleToDOMString(m_value);
1.3 +4 -4 xml-xalan/c/src/XPath/XNumber.hpp
Index: XNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNumber.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XNumber.hpp 2000/03/03 19:00:19 1.2
+++ XNumber.hpp 2000/04/11 14:46:14 1.3
@@ -64,7 +64,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -97,7 +97,7 @@
virtual eObjectType
getType() const;
- virtual DOMString
+ virtual XalanDOMString
getTypeString() const;
virtual double
@@ -106,7 +106,7 @@
virtual bool
boolean() const;
- virtual DOMString
+ virtual XalanDOMString
str() const;
virtual const ResultTreeFragBase&
@@ -136,7 +136,7 @@
private:
// Value of the number being represented.
- double m_value;
+ double m_value;
};
1.2 +7 -3 xml-xalan/c/src/XPath/XObject.cpp
Index: XObject.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XObject.cpp 1999/12/18 19:47:55 1.1
+++ XObject.cpp 2000/04/11 14:46:14 1.2
@@ -91,13 +91,17 @@
void
-XObject::error(const DOMString& msg) const
+XObject::error(const XalanDOMString& msg) const
{
const bool shouldThrow =
m_envSupport->problem(XPathEnvSupport::eXPATHProcessor,
XPathEnvSupport::eError,
- DOM_Node(),
- DOM_Node(),
+#if defined(XALAN_OLD_STYLE_CASTS)
+ (XalanNode*)0,
+#else
+
static_cast<XalanNode*>(0),
+#endif
+ 0,
msg,
0,
0);
1.4 +4 -5 xml-xalan/c/src/XPath/XObject.hpp
Index: XObject.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XObject.hpp 2000/03/06 17:13:51 1.3
+++ XObject.hpp 2000/04/11 14:46:14 1.4
@@ -64,8 +64,7 @@
-#include <dom/DOM_DocumentFragment.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -104,7 +103,7 @@
*
* @return string for type
*/
- virtual DOMString
+ virtual XalanDOMString
getTypeString() const = 0;
/**
@@ -128,7 +127,7 @@
*
* @return string value
*/
- virtual DOMString
+ virtual XalanDOMString
str() const = 0;
/**
@@ -226,7 +225,7 @@
* exception.
*/
virtual void
- error(const DOMString& msg) const;
+ error(const XalanDOMString& msg) const;
// Data member...
XPathEnvSupport* const m_envSupport;
1.4 +9 -10 xml-xalan/c/src/XPath/XObjectFactory.hpp
Index: XObjectFactory.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactory.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XObjectFactory.hpp 2000/03/07 16:13:44 1.3
+++ XObjectFactory.hpp 2000/04/11 14:46:15 1.4
@@ -78,8 +78,7 @@
-class DOM_Node;
-class DOMString;
+class XalanNode;
class MutableNodeRefList;
class NodeRefListBase;
class ResultTreeFragBase;
@@ -157,8 +156,8 @@
*/
virtual XObject*
createNodeSet(
- const DOM_Node& theValue,
- bool fOptimize = true) = 0;
+ XalanNode& theValue,
+ bool fOptimize = true) = 0;
/**
* Create a null XObject.
@@ -192,8 +191,8 @@
*/
virtual XObject*
createString(
- const DOMString& theValue,
- bool fOptimize = true) = 0;
+ const XalanDOMString& theValue,
+ bool fOptimize =
true) = 0;
/**
* Create an "unknown" XObject from a string.
@@ -204,8 +203,8 @@
*/
virtual XObject*
createUnknown(
- const DOMString& theValue,
- bool fOptimize = true) = 0;
+ const XalanDOMString& theValue,
+ bool fOptimize =
true) = 0;
/**
* Create a result tree fragment XObject from a result tree fragment.
@@ -252,8 +251,8 @@
*/
virtual XObject*
createSpan(
- const DOM_Node& theValue,
- bool fOptimize = true) = 0;
+ XalanNode& theValue,
+ bool fOptimize = true) = 0;
protected:
1.6 +70 -16 xml-xalan/c/src/XPath/XObjectFactoryDefault.cpp
Index: XObjectFactoryDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactoryDefault.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XObjectFactoryDefault.cpp 2000/03/07 16:13:44 1.5
+++ XObjectFactoryDefault.cpp 2000/04/11 14:46:15 1.6
@@ -64,10 +64,6 @@
-#include <PlatformSupport/STLHelper.hpp>
-
-
-
#include "XBoolean.hpp"
#include "XBooleanStatic.hpp"
#include "XNodeSet.hpp"
@@ -93,8 +89,17 @@
m_envSupport(theEnvSupport),
m_support(theSupport),
m_xobjects(),
- m_XNull(this,
- new XNull(m_envSupport, m_support))
+ m_XNull(new XNull(theEnvSupport, theSupport))
+#if !defined(NDEBUG)
+ , m_totalBooleanInstanceCount(0),
+ m_totalNodeSetInstanceCount(0),
+ m_totalNullInstanceCount(1),
+ m_totalNumberInstanceCount(0),
+ m_totalStringInstanceCount(0),
+ m_totalUnknownInstanceCount(0),
+ m_totalResultTreeFragInstanceCount(0),
+ m_totalSpanInstanceCount(0)
+#endif
{
}
@@ -103,6 +108,8 @@
XObjectFactoryDefault::~XObjectFactoryDefault()
{
reset();
+
+ deleteObject(m_XNull);
}
@@ -114,7 +121,7 @@
{
if (theFactoryObject == &theTrueBoolean ||
theFactoryObject == &theFalseBoolean ||
- theFactoryObject == m_XNull.get())
+ theFactoryObject == m_XNull)
{
return true;
}
@@ -156,6 +163,9 @@
m_xobjects.insert(theBoolean);
+#if !defined(NDEBUG)
+ ++m_totalBooleanInstanceCount;
+#endif
return theBoolean;
}
}
@@ -171,6 +181,10 @@
m_xobjects.insert(theXNodeSet);
+#if !defined(NDEBUG)
+ ++m_totalNodeSetInstanceCount;
+#endif
+
return theXNodeSet;
}
@@ -185,6 +199,10 @@
m_xobjects.insert(theXNodeSet);
+#if !defined(NDEBUG)
+ ++m_totalNodeSetInstanceCount;
+#endif
+
return theXNodeSet;
}
@@ -192,13 +210,17 @@
XObject*
XObjectFactoryDefault::createNodeSet(
- const DOM_Node& value,
- bool /* fOptimize */)
+ XalanNode& value,
+ bool /* fOptimize */)
{
XNodeSet* const theXNodeSet = new XNodeSet(m_envSupport,
m_support, value);
m_xobjects.insert(theXNodeSet);
+#if !defined(NDEBUG)
+ ++m_totalNodeSetInstanceCount;
+#endif
+
return theXNodeSet;
}
@@ -209,7 +231,7 @@
{
if (fOptimize == true)
{
- return m_XNull.get();
+ return m_XNull;
}
else
{
@@ -217,6 +239,10 @@
m_xobjects.insert(theXNull);
+#if !defined(NDEBUG)
+ ++m_totalNullInstanceCount;
+#endif
+
return theXNull;
}
}
@@ -232,6 +258,10 @@
m_xobjects.insert(theXNumber);
+#if !defined(NDEBUG)
+ ++m_totalNumberInstanceCount;
+#endif
+
return theXNumber;
}
@@ -239,13 +269,17 @@
XObject*
XObjectFactoryDefault::createString(
- const DOMString& theValue,
- bool /* fOptimize */)
+ const XalanDOMString& theValue,
+ bool /* fOptimize */)
{
XString* const theXString = new XString(m_envSupport, m_support,
theValue);
m_xobjects.insert(theXString);
+#if !defined(NDEBUG)
+ ++m_totalStringInstanceCount;
+#endif
+
return theXString;
}
@@ -253,13 +287,17 @@
XObject*
XObjectFactoryDefault::createUnknown(
- const DOMString& theValue,
- bool /* fOptimize */)
+ const XalanDOMString& theValue,
+ bool /* fOptimize */)
{
XUnknown* const theXUnknown = new XUnknown(m_envSupport, theValue);
m_xobjects.insert(theXUnknown);
+#if !defined(NDEBUG)
+ ++m_totalUnknownInstanceCount;
+#endif
+
return theXUnknown;
}
@@ -274,6 +312,10 @@
m_xobjects.insert(theResultTreeFrag);
+#if !defined(NDEBUG)
+ ++m_totalResultTreeFragInstanceCount;
+#endif
+
return theResultTreeFrag;
}
@@ -288,6 +330,10 @@
m_xobjects.insert(theXSpan);
+#if !defined(NDEBUG)
+ ++m_totalSpanInstanceCount;
+#endif
+
return theXSpan;
}
@@ -302,6 +348,10 @@
m_xobjects.insert(theXSpan);
+#if !defined(NDEBUG)
+ ++m_totalSpanInstanceCount;
+#endif
+
return theXSpan;
}
@@ -309,12 +359,16 @@
XObject*
XObjectFactoryDefault::createSpan(
- const DOM_Node& theValue,
- bool /* fOptimize */)
+ XalanNode& theValue,
+ bool /* fOptimize */)
{
XSpan* const theXSpan = new XSpan(m_envSupport, m_support, theValue);
m_xobjects.insert(theXSpan);
+
+#if !defined(NDEBUG)
+ ++m_totalSpanInstanceCount;
+#endif
return theXSpan;
}
1.5 +85 -16 xml-xalan/c/src/XPath/XObjectFactoryDefault.hpp
Index: XObjectFactoryDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactoryDefault.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XObjectFactoryDefault.hpp 2000/03/08 20:58:02 1.4
+++ XObjectFactoryDefault.hpp 2000/04/11 14:46:15 1.5
@@ -64,11 +64,8 @@
-#if !defined(XALAN_XTREE_BUG)
#include <set>
-#else
-#error Need to implement CollectionType as a vector
-#endif
+
// Base class header file...
@@ -127,8 +124,8 @@
virtual XObject*
createNodeSet(
- const DOM_Node& value,
- bool fOptimize = true);
+ XalanNode& value,
+ bool fOptimize = true);
virtual XObject*
createNull(bool fOptimize = true);
@@ -140,13 +137,13 @@
virtual XObject*
createString(
- const DOMString& theValue,
- bool fOptimize = true);
+ const XalanDOMString& theValue,
+ bool fOptimize =
true);
virtual XObject*
createUnknown(
- const DOMString& theValue,
- bool fOptimize = true);
+ const XalanDOMString& theValue,
+ bool fOptimize =
true);
virtual XObject*
createResultTreeFrag(
@@ -165,8 +162,8 @@
virtual XObject*
createSpan(
- const DOM_Node& value,
- bool fOptimize = true);
+ XalanNode& value,
+ bool fOptimize = true);
#if defined(XALAN_NO_NAMESPACES)
typedef set<const FactoryObject*> CollectionType;
@@ -184,6 +181,58 @@
{
return m_xobjects.size();
}
+
+#if !defined(NDEBUG)
+
+ unsigned long
+ getTotalBooleanInstanceCount() const
+ {
+ return m_totalBooleanInstanceCount;
+ }
+
+ unsigned long
+ getTotalNodeSetInstanceCount() const
+ {
+ return m_totalNodeSetInstanceCount;
+ }
+
+ unsigned long
+ getTotalNullInstanceCount() const
+ {
+ return m_totalNullInstanceCount;
+ }
+
+ unsigned long
+ getTotalNumberInstanceCount() const
+ {
+ return m_totalNumberInstanceCount;
+ }
+
+ unsigned long
+ getTotalStringInstanceCount() const
+ {
+ return m_totalStringInstanceCount;
+ }
+
+ unsigned long
+ getTotalUnknownInstanceCount() const
+ {
+ return m_totalUnknownInstanceCount;
+ }
+
+ unsigned long
+ getTotalResultTreeFragInstanceCount() const
+ {
+ return m_totalResultTreeFragInstanceCount;
+ }
+
+ unsigned long
+ getTotalSpanInstanceCount() const
+ {
+ return m_totalSpanInstanceCount;
+ }
+
+#endif
protected:
@@ -207,12 +256,32 @@
// Data members...
- XPathEnvSupport&
m_envSupport;
- XPathSupport&
m_support;
+ XPathEnvSupport& m_envSupport;
+ XPathSupport& m_support;
+
+ CollectionType m_xobjects;
- CollectionType
m_xobjects;
+ XObject* const m_XNull;
- const FactoryObjectAutoPointer<XObject> m_XNull;
+#if !defined(NDEBUG)
+
+ unsigned long m_totalBooleanInstanceCount;
+
+ unsigned long m_totalNodeSetInstanceCount;
+
+ unsigned long m_totalNullInstanceCount;
+
+ unsigned long m_totalNumberInstanceCount;
+
+ unsigned long m_totalStringInstanceCount;
+
+ unsigned long m_totalUnknownInstanceCount;
+
+ unsigned long m_totalResultTreeFragInstanceCount;
+
+ unsigned long m_totalSpanInstanceCount;
+
+#endif
};
1.3 +8 -3 xml-xalan/c/src/XPath/XObjectTypeCallback.hpp
Index: XObjectTypeCallback.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectTypeCallback.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XObjectTypeCallback.hpp 2000/03/03 19:00:20 1.2
+++ XObjectTypeCallback.hpp 2000/04/11 14:46:16 1.3
@@ -64,7 +64,12 @@
-class DOMString;
+// $$$ ToDo: This is necessarh while XalanDOMString is a typedef...
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
+
class MutableNodeRefList;
class NodeRefListBase;
class ResultTreeFragBase;
@@ -117,7 +122,7 @@
*/
virtual void
String(const XObject& theXObject,
- const DOMString& theValue) = 0;
+ const XalanDOMString& theValue) = 0;
/**
* Call back the XObject with a result tree fragment value.
@@ -157,7 +162,7 @@
*/
virtual void
Unknown(const XObject& theObject,
- const DOMString& theName) = 0;
+ const XalanDOMString& theName) = 0;
/**
* Call back the XObject with a null value.
1.8 +190 -134 xml-xalan/c/src/XPath/XPath.cpp
Index: XPath.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XPath.cpp 2000/03/22 20:00:17 1.7
+++ XPath.cpp 2000/04/11 14:46:16 1.8
@@ -64,7 +64,6 @@
-#include <Include/DOMHelper.hpp>
#include <PlatformSupport/DoubleSupport.hpp>
#include <PlatformSupport/STLHelper.hpp>
@@ -85,12 +84,12 @@
#if !defined(XALAN_INLINE_INITIALIZATION)
-const char* const XPath::PSEUDONAME_ANY = "*";
-const char* const XPath::PSEUDONAME_ROOT = "/";
-const char* const XPath::PSEUDONAME_TEXT =
"#text";
-const char* const XPath::PSEUDONAME_COMMENT =
"#comment";
-const char* const XPath::PSEUDONAME_PI = "#pi";
-const char* const XPath::PSEUDONAME_OTHER = "*";
+const XalanDOMString
XPath::PSEUDONAME_ANY(XALAN_STATIC_UCODE_STRING("*"));
+const XalanDOMString
XPath::PSEUDONAME_ROOT(XALAN_STATIC_UCODE_STRING("/"));
+const XalanDOMString
XPath::PSEUDONAME_TEXT(XALAN_STATIC_UCODE_STRING("#text"));
+const XalanDOMString
XPath::PSEUDONAME_COMMENT(XALAN_STATIC_UCODE_STRING("#comment"));
+const XalanDOMString
XPath::PSEUDONAME_PI(XALAN_STATIC_UCODE_STRING("#pi"));
+const XalanDOMString
XPath::PSEUDONAME_OTHER(XALAN_STATIC_UCODE_STRING("*"));
const double XPath::s_MatchScoreNone =
-9999999999999.0;
const double XPath::s_MatchScoreQName = 0.0;
@@ -127,18 +126,10 @@
-XObject*
-XPath::execute(XPathExecutionContext& executionContext) const
-{
- return execute(executionContext.getCurrentNode(), 0, executionContext);
-}
-
-
-
void
XPath::installFunction(
- const DOMString& funcName,
- const Function& func)
+ const XalanDOMString& funcName,
+ const Function& func)
{
s_functions.InstallFunction(funcName,
func);
@@ -155,15 +146,25 @@
XObject*
+XPath::execute(XPathExecutionContext& executionContext) const
+{
+ assert(executionContext.getPrefixResolver() != 0);
+
+ return executeMore(executionContext.getCurrentNode(), 0,
executionContext);
+}
+
+
+
+XObject*
XPath::execute(
- const DOM_Node& context,
+ XalanNode* context,
const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const
{
const PrefixResolver* const theSavedResolver =
executionContext.getPrefixResolver();
- const DOM_Node theSavedCurrentNode =
+ XalanNode* const theSavedCurrentNode =
executionContext.getCurrentNode();
XObject* theResult = 0;
@@ -193,7 +194,7 @@
XObject*
XPath::execute(
- const DOM_Node& context,
+ XalanNode* context,
const PrefixResolver& prefixResolver,
const NodeRefListBase& contextNodeList,
XPathExecutionContext& executionContext) const
@@ -223,8 +224,8 @@
XObject*
-XPath::execute(
- const DOM_Node& context,
+XPath::executeMore(
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -233,7 +234,7 @@
switch(m_expression.m_opMap[opPos])
{
case XPathExpression::eOP_XPATH:
- result = execute(context, opPos + 2, executionContext);
+ result = executeMore(context, opPos + 2, executionContext);
break;
case XPathExpression::eOP_MATCHPATTERN:
@@ -440,9 +441,9 @@
default:
{
- const DOMString theOpCode =
LongToDOMString(m_expression.m_opMap[opPos]);
+ const XalanDOMString theOpCode =
LongToDOMString(m_expression.m_opMap[opPos]);
- executionContext.error(DOMString("ERROR! Unknown op
code: ") + theOpCode,
+ executionContext.error(XalanDOMString("ERROR! Unknown
op code: ") + theOpCode,
context);
}
break;
@@ -454,7 +455,8 @@
double
-XPath::getMatchScore(const DOM_Node& context,
+XPath::getMatchScore(XalanNode* context,
+ const PrefixResolver&
resolver,
XPathExecutionContext&
executionContext) const
{
double score = s_MatchScoreNone;
@@ -463,30 +465,47 @@
if(m_expression.m_opMap[opPos] == XPathExpression::eOP_MATCHPATTERN)
{
- opPos += 2;
+ assert(context != 0);
- XLocator* locator =
executionContext.getXLocatorFromNode(context);
+ const PrefixResolver* const theSavedResolver =
+ executionContext.getPrefixResolver();
- if(0 == locator)
- {
- locator = m_defaultXLocator;
- }
- assert(locator != 0);
+ executionContext.setPrefixResolver(&resolver);
- while(m_expression.m_opMap[opPos] ==
XPathExpression::eOP_LOCATIONPATHPATTERN &&
- score == s_MatchScoreNone)
+ try
{
- const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
+ opPos += 2;
- // opPos+=2;
- score = locator->locationPathPattern(*this,
executionContext, context, opPos);
+ XLocator* locator =
executionContext.getXLocatorFromNode(context);
- if(score == s_MatchScoreNone)
+ if(0 == locator)
{
- opPos = nextOpPos;
+ locator = m_defaultXLocator;
+ }
+ assert(locator != 0);
+
+ while(m_expression.m_opMap[opPos] ==
XPathExpression::eOP_LOCATIONPATHPATTERN &&
+ score == s_MatchScoreNone)
+ {
+ const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
+
+ // opPos+=2;
+ score = locator->locationPathPattern(*this,
executionContext, *context, opPos);
+
+ if(score == s_MatchScoreNone)
+ {
+ opPos = nextOpPos;
+ }
}
}
-
+ catch(...)
+ {
+ executionContext.setPrefixResolver(theSavedResolver);
+
+ throw;
+ }
+
+ executionContext.setPrefixResolver(theSavedResolver);
}
else
{
@@ -501,7 +520,7 @@
double
XPath::nodeTest(
- const DOM_Node& context,
+ XalanNode* context,
int /*
opPos */,
int /*
argLen */,
int /*
stepType */,
@@ -591,10 +610,10 @@
if(tokenIndex
>= 0)
{
- const
DOMString targetName =
+ const
XalanDOMString targetName =
m_expression.m_tokenQueue[tokenIndex]->str();
-
if(::equals(targetName, "*") == true)
+
if(::equals(targetName, PSEUDONAME_ANY) == true)
{
targetStrings.push_back(PSEUDONAME_ANY);
}
@@ -630,18 +649,18 @@
XObject*
XPath::xpath(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- return execute(context, opPos + 2, executionContext);
+ return executeMore(context, opPos + 2, executionContext);
}
XObject*
XPath::matchPattern(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
@@ -652,7 +671,7 @@
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
- score = execute(context, opPos, executionContext);
+ score = executeMore(context, opPos, executionContext);
if(score->num() != s_MatchScoreNone)
{
@@ -674,7 +693,7 @@
MutableNodeRefList*
XPath::step(
- const DOM_Node& context,
+ XalanNode* context,
int /*
opPos */,
XPathExecutionContext& executionContext) const
{
@@ -688,13 +707,13 @@
XObject*
XPath::or(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
bool fResult = expr1->boolean();
@@ -703,7 +722,7 @@
{
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos,
executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
fResult = expr2->boolean();
@@ -716,7 +735,7 @@
XObject*
XPath::and(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -724,14 +743,14 @@
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
if (expr1->boolean() == true)
{
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos,
executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
if (expr2->boolean() == true)
@@ -747,18 +766,18 @@
XObject*
XPath::notequals(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos, executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
return
executionContext.getXObjectFactory().createBoolean(!expr1->equals(*expr2));
@@ -768,18 +787,18 @@
XObject*
XPath::equals(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos, executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
return
executionContext.getXObjectFactory().createBoolean(expr1->equals(*expr2));
@@ -789,7 +808,7 @@
XObject*
XPath::lte(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -797,7 +816,7 @@
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const double expr1Value = expr1->num();
@@ -806,7 +825,7 @@
{
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos,
executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
const double expr2Value = expr2->num();
@@ -827,7 +846,7 @@
XObject*
XPath::lt(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -835,7 +854,7 @@
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const double expr1Value = expr1->num();
@@ -844,7 +863,7 @@
{
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos,
executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
const double expr2Value = expr2->num();
@@ -865,7 +884,7 @@
XObject*
XPath::gte(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -873,7 +892,7 @@
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const double expr1Value = expr1->num();
@@ -882,7 +901,7 @@
{
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos,
executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
const double expr2Value = expr2->num();
@@ -903,7 +922,7 @@
XObject*
XPath::gt(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -911,7 +930,7 @@
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const double expr1Value = expr1->num();
@@ -920,7 +939,7 @@
{
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos,
executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
const double expr2Value = expr2->num();
@@ -941,18 +960,18 @@
XObject*
XPath::plus(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos, executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
return executionContext.getXObjectFactory().createNumber(expr1->num() +
expr2->num());
@@ -962,18 +981,18 @@
XObject*
XPath::minus(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos, executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
return executionContext.getXObjectFactory().createNumber(expr1->num() -
expr2->num());
@@ -983,18 +1002,18 @@
XObject*
XPath::mult(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos, executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
return executionContext.getXObjectFactory().createNumber(expr1->num() *
expr2->num());
@@ -1004,39 +1023,72 @@
XObject*
XPath::div(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos, executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
+
+ const double expr1Value = expr1->num();
+
+ const double expr2Value = expr2->num();
+
+ double theResult = 0.0;
+
+ if (expr2Value != 0)
+ {
+ // The simple case...
+ theResult = expr1Value / expr2Value;
+ }
+ else
+ {
+ // Special cases, since we don't want to actually do the
division...
+ if (expr1Value == 0)
+ {
+ // This is NaN...
+ theResult = DoubleSupport::getNaN();
+ }
+ else if (expr1Value > 0.0)
+ {
+ // This is positive infinity...
+ theResult = DoubleSupport::getPositiveInfinity();
+ }
+ else
+ {
+ assert(expr1Value < 0.0);
+
+ // This is positive infinity...
+ theResult = DoubleSupport::getNegativeInfinity();
+ }
+ }
- return executionContext.getXObjectFactory().createNumber(expr1->num() /
expr2->num());
+ return executionContext.getXObjectFactory().createNumber(theResult);
}
XObject*
XPath::mod(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
opPos += 2;
- XObject* const expr1 = execute(context, opPos, executionContext);
+ XObject* const expr1 = executeMore(context, opPos, executionContext);
assert(expr1 != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = execute(context, expr2Pos, executionContext);
+ XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
assert(expr2 != 0);
return
executionContext.getXObjectFactory().createNumber(static_cast<int>(expr1->num())
%
@@ -1047,7 +1099,7 @@
XObject*
XPath::quo(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -1061,11 +1113,11 @@
XObject*
XPath::neg(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = execute(context, opPos + 2, executionContext);
+ XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
assert(expr1 != 0);
return executionContext.getXObjectFactory().createNumber(-expr1->num());
@@ -1075,11 +1127,11 @@
XObject*
XPath::string(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = execute(context, opPos + 2, executionContext);
+ XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
assert(expr1 != 0);
return executionContext.getXObjectFactory().createString(expr1->str());
@@ -1089,11 +1141,11 @@
XObject*
XPath::boolean(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = execute(context, opPos + 2, executionContext);
+ XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
assert(expr1 != 0);
return
executionContext.getXObjectFactory().createBoolean(expr1->boolean());
@@ -1103,11 +1155,11 @@
XObject*
XPath::number(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = execute(context, opPos + 2, executionContext);
+ XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
assert(expr1 != 0);
return executionContext.getXObjectFactory().createNumber(expr1->num());
@@ -1117,7 +1169,7 @@
XObject*
XPath::Union(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -1129,7 +1181,7 @@
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
- XObject* expr = execute(context, opPos,
executionContext);
+ XObject* expr = executeMore(context, opPos,
executionContext);
if(0 == resultNodeSet)
{
@@ -1153,7 +1205,7 @@
XObject*
XPath::literal(
- const DOM_Node& /* context */,
+ XalanNode* /* context */,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -1167,7 +1219,7 @@
XObject*
XPath::variable(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -1187,15 +1239,15 @@
}
catch(...)
{
- executionContext.error(DOMString("Could not get variable named
") + varName->str());
+ executionContext.error(XalanDOMString("Could not get variable
named ") + varName->str());
}
if(0 == result)
{
- executionContext.warn(DOMString("VariableReference given for
variable out ") +
- DOMString("of
context or without definition! Name = ") +
- varName->str(),
- context);
+ executionContext.warn(XalanDOMString("VariableReference given
for variable out ") +
+
XalanDOMString("of context or without definition! Name = ") +
+ varName->str(),
+ context);
}
return result;
@@ -1205,18 +1257,18 @@
XObject*
XPath::group(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- return execute(context, opPos + 2, executionContext);
+ return executeMore(context, opPos + 2, executionContext);
}
XObject*
XPath::numberlit(
- const DOM_Node& /* context */,
+ XalanNode* /* context */,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -1230,21 +1282,23 @@
XObject*
XPath::arg(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- return execute(context, opPos + 2, executionContext);
+ return executeMore(context, opPos + 2, executionContext);
}
XObject*
XPath::locationPath(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
+ assert(context != 0);
+
/*
const int stepType = m_expression.m_opMap[opPos + 2];
@@ -1279,18 +1333,18 @@
xlocator = m_defaultXLocator;
}
- return xlocator->locationPath(*this, executionContext, context, opPos);
+ return xlocator->locationPath(*this, executionContext, *context, opPos);
}
XObject*
XPath::predicate(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = execute(context, opPos + 2, executionContext);
+ XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
// $$$ ToDo: This appears to be just an optimization, but is it really?
/*
@@ -1308,10 +1362,12 @@
XObject*
XPath::locationPathPattern(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
+ assert(context != 0);
+
XLocator* locator = executionContext.getXLocatorFromNode(context);
if(0 == locator)
@@ -1319,7 +1375,7 @@
locator = m_defaultXLocator;
}
- const double result = locator->locationPathPattern(*this,
executionContext, context, opPos);
+ const double result = locator->locationPathPattern(*this,
executionContext, *context, opPos);
return executionContext.getXObjectFactory().createNumber(result);
}
@@ -1328,7 +1384,7 @@
XObject*
XPath::runExtFunction(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -1350,7 +1406,7 @@
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
- args.push_back(execute(context, opPos, executionContext));
+ args.push_back(executeMore(context, opPos, executionContext));
opPos = nextOpPos;
}
@@ -1362,12 +1418,12 @@
XObject*
XPath::extfunction(
- const DOM_Node& /*
context */,
- int
/* opPos */,
- const DOMString&
theNamespace,
- const DOMString&
extensionName,
- const std::vector<XObject*>& argVec,
- XPathExecutionContext&
executionContext) const
+ XalanNode*
/* context */,
+ int
/* opPos */,
+ const XalanDOMString&
theNamespace,
+ const XalanDOMString&
extensionName,
+ const Function::XObjectArgVectorType& argVec,
+ XPathExecutionContext&
executionContext) const
{
return executionContext.extFunction(theNamespace,
extensionName,
@@ -1378,7 +1434,7 @@
XObject*
XPath::runFunction(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
@@ -1398,7 +1454,7 @@
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
- args.push_back(execute(context, opPos, executionContext));
+ args.push_back(executeMore(context, opPos, executionContext));
opPos = nextOpPos;
}
@@ -1410,16 +1466,16 @@
XObject*
XPath::function(
- const DOM_Node& context,
- int
opPos,
- int
funcID,
- const std::vector<XObject*>& argVec,
- XPathExecutionContext&
executionContext) const
+ XalanNode*
context,
+ int
opPos,
+ int
funcID,
+ const Function::XObjectArgVectorType& argVec,
+ XPathExecutionContext&
executionContext) const
{
assert(m_expression.getToken(funcID) != 0);
- const DOMString
theFunctionName(m_expression.getToken(funcID)->str());
+ const XalanDOMString
theFunctionName(m_expression.getToken(funcID)->str());
assert(!isEmpty(theFunctionName));
return s_functions[theFunctionName].execute(executionContext, context,
opPos, argVec);
1.5 +91 -196 xml-xalan/c/src/XPath/XPath.hpp
Index: XPath.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPath.hpp 2000/03/03 19:00:20 1.4
+++ XPath.hpp 2000/04/11 14:46:16 1.5
@@ -70,9 +70,7 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Element.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -88,6 +86,7 @@
#include <XPath/MutableNodeRefList.hpp>
#include <XPath/XPathExpression.hpp>
+#include <XPath/Function.hpp>
#include <XPath/XPathFunctionTable.hpp>
@@ -98,6 +97,7 @@
class XObjectFactory;
class XPathEnvSupport;
class XPathSupport;
+class XalanNode;
@@ -115,29 +115,26 @@
public:
#if defined(XALAN_INLINE_INITIALIZATION)
- const char* const PSEUDONAME_ANY = "*";
- const char* const PSEUDONAME_ROOT = "/";
- const char* const PSEUDONAME_TEXT = "#text";
- const char* const PSEUDONAME_COMMENT = "#comment";
- const char* const PSEUDONAME_PI = "#pi";
- const char* const PSEUDONAME_OTHER = "*";
+ const XalanDOMString
PSEUDONAME_ANY(XALAN_STATIC_UCODE_STRING("*"));
+ const XalanDOMString
PSEUDONAME_ROOT(XALAN_STATIC_UCODE_STRING("/"));
+ const XalanDOMString
PSEUDONAME_TEXT(XALAN_STATIC_UCODE_STRING("#text"));
+ const XalanDOMString
PSEUDONAME_COMMENT(XALAN_STATIC_UCODE_STRING("#comment"));
+ const XalanDOMString
PSEUDONAME_PI(XALAN_STATIC_UCODE_STRING("#pi"));
+ const XalanDOMString
PSEUDONAME_OTHER(XALAN_STATIC_UCODE_STRING("*"));
#else
- static const char* const PSEUDONAME_ANY;
- static const char* const PSEUDONAME_ROOT;
- static const char* const PSEUDONAME_TEXT;
- static const char* const PSEUDONAME_COMMENT;
- static const char* const PSEUDONAME_PI;
- static const char* const PSEUDONAME_OTHER;
+ static const XalanDOMString PSEUDONAME_ANY;
+ static const XalanDOMString PSEUDONAME_ROOT;
+ static const XalanDOMString PSEUDONAME_TEXT;
+ static const XalanDOMString PSEUDONAME_COMMENT;
+ static const XalanDOMString PSEUDONAME_PI;
+ static const XalanDOMString PSEUDONAME_OTHER;
#endif
#if defined(XALAN_NO_NAMESPACES)
-# define XALAN_STD
+ typedef vector<XalanDOMString>
TargetElementStringsVectorType;
#else
-# define XALAN_STD std::
+ typedef std::vector<XalanDOMString>
TargetElementStringsVectorType;
#endif
- typedef XALAN_STD vector<DOMString> TargetElementStringsVectorType;
- typedef XALAN_STD vector<XObject*> XObjectPtrVectorType;
-#undef XALAN_STD
/**
@@ -155,28 +152,20 @@
virtual void
shrink();
- /**
- * Execute the XPath from the provided context.
- *
- * @param executionContext current execution context
- * @exception exception
- * @return pointer to result XObject
- */
- virtual XObject*
- execute(XPathExecutionContext& executionContext) const;
+public:
/**
* Execute the XPath from the provided context.
*
* @param context current source tree context node
- * @param opPos current position in the m_opMap array
+ * @param prefixResolver prefix resolver to use
* @param executionContext current execution context
* @return pointer to union of node-set operands
*/
virtual XObject*
execute(
- const DOM_Node& context,
- int opPos,
+ XalanNode* context,
+ const PrefixResolver& prefixResolver,
XPathExecutionContext& executionContext) const;
/**
@@ -184,29 +173,40 @@
*
* @param context current source tree context node
* @param prefixResolver prefix resolver to use
+ * @param contextNodeList node list for current context
* @param executionContext current execution context
* @return pointer to union of node-set operands
*/
virtual XObject*
execute(
- const DOM_Node& context,
+ XalanNode* context,
const PrefixResolver& prefixResolver,
+ const NodeRefListBase& contextNodeList,
XPathExecutionContext& executionContext) const;
/**
+ * Execute the XPath from the provided context. The
+ * prefix resolver must already be set in the
+ * execution context.
+ *
+ * @param executionContext current execution context
+ * @return pointer to result XObject
+ */
+ virtual XObject*
+ execute(XPathExecutionContext& executionContext) const;
+
+ /**
* Execute the XPath from the provided context.
*
* @param context current source tree context node
- * @param prefixResolver prefix resolver to use
- * @param contextNodeList node list for current context
+ * @param opPos current position in the m_opMap array
* @param executionContext current execution context
* @return pointer to union of node-set operands
*/
virtual XObject*
- execute(
- const DOM_Node& context,
- const PrefixResolver& prefixResolver,
- const NodeRefListBase& contextNodeList,
+ executeMore(
+ XalanNode* context,
+ int opPos,
XPathExecutionContext& executionContext) const;
/**
@@ -219,7 +219,7 @@
*/
virtual XObject*
locationPath(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -309,8 +309,10 @@
* @return union of node-set operands
*/
virtual double
- getMatchScore(const DOM_Node& context,
- XPathExecutionContext&
executionContext) const;
+ getMatchScore(
+ XalanNode* context,
+ const PrefixResolver& resolver,
+ XPathExecutionContext& executionContext) const;
/**
* Test a node. This should be implemented by a derived class.
@@ -326,7 +328,7 @@
*/
virtual double
nodeTest(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
int argLen,
int
stepType,
@@ -342,7 +344,7 @@
*/
virtual XObject*
predicate(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -362,7 +364,7 @@
*/
static void
installFunction(
- const DOMString& funcName,
+ const XalanDOMString& funcName,
const Function& func);
/**
@@ -372,7 +374,7 @@
* @return true if the function has been installed
*/
static bool
- isInstalledFunction(const DOMString& theFunctionName)
+ isInstalledFunction(const XalanDOMString& theFunctionName)
{
return s_functions.isInstalledFunction(theFunctionName);
}
@@ -438,7 +440,7 @@
*/
virtual XObject*
xpath(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -450,7 +452,7 @@
*/
virtual XObject*
matchPattern(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -464,10 +466,12 @@
*/
MutableNodeRefList*
step(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
+protected:
+
/**
* OR two expressions and return the boolean result.
* @param context The current source tree context node.
@@ -476,7 +480,7 @@
*/
virtual XObject*
or(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -488,7 +492,7 @@
*/
virtual XObject*
and(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -500,7 +504,7 @@
*/
virtual XObject*
notequals(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -512,7 +516,7 @@
*/
virtual XObject*
equals(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -524,7 +528,7 @@
*/
virtual XObject*
lte(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -536,7 +540,7 @@
*/
virtual XObject*
lt(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -548,7 +552,7 @@
*/
virtual XObject*
gte(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -560,7 +564,7 @@
*/
virtual XObject*
gt(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -572,7 +576,7 @@
*/
virtual XObject*
plus(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -584,7 +588,7 @@
*/
virtual XObject*
minus(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -596,7 +600,7 @@
*/
virtual XObject*
mult(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -608,7 +612,7 @@
*/
virtual XObject*
div(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -620,7 +624,7 @@
*/
virtual XObject*
mod(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -633,7 +637,7 @@
*/
virtual XObject*
quo(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -645,7 +649,7 @@
*/
virtual XObject*
neg(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -657,7 +661,7 @@
*/
virtual XObject*
string(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -669,7 +673,7 @@
*/
virtual XObject*
boolean(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -681,7 +685,7 @@
*/
virtual XObject*
number(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -693,7 +697,7 @@
*/
virtual XObject*
Union(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -705,7 +709,7 @@
*/
virtual XObject*
literal(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -717,7 +721,7 @@
*/
virtual XObject*
variable(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -729,7 +733,7 @@
*/
virtual XObject*
group(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -741,7 +745,7 @@
*/
virtual XObject*
numberlit(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -753,7 +757,7 @@
*/
virtual XObject*
arg(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -766,7 +770,7 @@
*/
virtual XObject*
locationPathPattern(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -775,7 +779,7 @@
*/
virtual XObject*
runExtFunction(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -784,19 +788,19 @@
*/
virtual XObject*
extfunction(
- const DOM_Node& context,
- int
opPos,
- const DOMString&
theNamespace,
- const DOMString&
extensionName,
- const XObjectPtrVectorType& argVec,
- XPathExecutionContext&
executionContext) const;
+ XalanNode*
context,
+ int
opPos,
+ const XalanDOMString&
theNamespace,
+ const XalanDOMString&
extensionName,
+ const Function::XObjectArgVectorType& argVec,
+ XPathExecutionContext&
executionContext) const;
/**
* Setup for and run a function.
*/
virtual XObject*
runFunction(
- const DOM_Node& context,
+ XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const;
@@ -805,120 +809,11 @@
*/
virtual XObject*
function(
- const DOM_Node& context,
- int
opPos,
- int
funcID,
- const XObjectPtrVectorType& argVec,
- XPathExecutionContext&
executionContext) const;
-
-#if 0
- public Vector getTargetElementStrings()
- {
- Vector targetStrings = new Vector();
-
- int opPos = 2;
-
- while(m_opMap[opPos] == OP_LOCATIONPATHPATTERN)
- {
- int nextOpPos = getNextOpPos(opPos);
- opPos+=2;
-
- while( m_opMap[opPos] != ENDOP )
- {
- int nextStepPos = getNextOpPos(opPos);
- int nextOp = m_opMap[nextStepPos];
- if((nextOp == OP_PREDICATE) || (nextOp == ENDOP))
- {
- int stepType = m_opMap[opPos];
- opPos += 3;
- switch(stepType)
- {
- case OP_FUNCTION:
- targetStrings.addElement(PSEUDONAME_ANY);
- break;
- case FROM_ROOT:
- targetStrings.addElement(PSEUDONAME_ROOT);
- break;
- case MATCH_ATTRIBUTE:
- case MATCH_ANY_ANCESTOR:
- case MATCH_IMMEDIATE_ANCESTOR:
- int tok = m_opMap[opPos];
- opPos++;
- switch(tok)
- {
- case NODETYPE_COMMENT:
- targetStrings.addElement(PSEUDONAME_COMMENT);
- break;
- case NODETYPE_TEXT:
- targetStrings.addElement(PSEUDONAME_TEXT);
- break;
- case NODETYPE_NODE:
- targetStrings.addElement(PSEUDONAME_ANY);
- break;
- case NODETYPE_ROOT:
- targetStrings.addElement(PSEUDONAME_ROOT);
- break;
- case NODETYPE_ANYELEMENT:
- targetStrings.addElement(PSEUDONAME_ANY);
- break;
- case NODETYPE_PI:
- targetStrings.addElement(PSEUDONAME_ANY);
- break;
- case NODENAME:
- // Skip the namespace
- int tokenIndex = m_opMap[opPos+1];
- if(tokenIndex >= 0)
- {
- String targetName =
(String)m_tokenQueue[tokenIndex];
- if(targetName.equals("*"))
- {
- targetStrings.addElement(PSEUDONAME_ANY);
- }
- else
- {
- targetStrings.addElement(targetName);
- }
- }
- else
- {
- targetStrings.addElement(PSEUDONAME_ANY);
- }
- break;
- default:
- targetStrings.addElement(PSEUDONAME_ANY);
- break;
- }
- break;
- }
- }
- opPos = nextStepPos;
- }
-
- opPos = nextOpPos;
- }
- return targetStrings;
- }
-
- // ============= DIAGNOSTIC & ERROR HANDLINING =================
- private void ____DIAGNOSTICS_AND_ERRORS____(){}
-
- private final void trace(String s)
- {
- System.out.println(s);
- }
-
- /**
- * Tell the user of an assertion error, and probably throw an
- * exception.
- */
- private void assert(boolean b, String msg)
- {
- if(!b)
- error(null, "Programmer assertion is incorrect! - "+msg);
- }
-#endif
-
-
+ XalanNode*
context,
+ int
opPos,
+ int
funcID,
+ const Function::XObjectArgVectorType& argVec,
+ XPathExecutionContext&
executionContext) const;
private:
1.5 +59 -95 xml-xalan/c/src/XPath/XPathEnvSupport.hpp
Index: XPathEnvSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathEnvSupport.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathEnvSupport.hpp 2000/03/03 19:00:20 1.4
+++ XPathEnvSupport.hpp 2000/04/11 14:46:16 1.5
@@ -69,10 +69,8 @@
-#include <dom/DOM_Document.hpp>
-#include <dom/DOM_Element.hpp>
-#include <dom/DOM_NodeList.hpp>
-#include <dom/DOMString.hpp>
+// $$$ ToDo: Necessary while XalanDOMString is style a typedef.
+#include <XalanDOM/XalanDOMString.hpp>
@@ -81,12 +79,19 @@
+#include <XPath/Function.hpp>
+
+
+
class NodeRefListBase;
class PrefixResolver;
class XLocator;
class XObject;
class XPathExecutionContext;
class XObjectFactory;
+class XalanDocument;
+class XalanElement;
+class XalanNode;
class QName;
@@ -95,32 +100,13 @@
{
public:
+ typedef Function::XObjectArgVectorType XObjectArgVectorType;
+
XPathEnvSupport();
virtual
~XPathEnvSupport();
- /**
- * Given a valid element key, return the corresponding node list.
- *
- * @param doc source document
- * @param name name of the key, which must match the 'name'
- * attribute on xsl:key
- * @param ref value that must match the value found by the
- * 'match' attribute on xsl:key
- * @param nscontext context node for namespace resolution
- * @param executionContext current execution context
- * @return if the name was not declared with xsl:key, this will return
- * null, if the identifier is not found, it will return an empty
- * node set, otherwise it will return a nodeset of nodes.
- */
- virtual const NodeRefListBase*
- getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const DOM_Element& nscontext,
- XPathExecutionContext& executionContext) const = 0;
/**
* Given a valid element key, return the corresponding node list.
@@ -138,9 +124,9 @@
*/
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
const PrefixResolver& resolver,
XPathExecutionContext& executionContext) const = 0;
@@ -163,10 +149,10 @@
* @param base base location for URI
* @return parsed document
*/
- virtual DOM_Document
+ virtual XalanDocument*
parseXML(
- const DOMString& urlString,
- const DOMString& base) const = 0;
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) = 0;
/**
* Get the source document for the given URI.
@@ -174,8 +160,8 @@
* @param theURI document URI
* @return source document
*/
- virtual DOM_Document
- getSourceDocument(const DOMString& theURI) const = 0;
+ virtual XalanDocument*
+ getSourceDocument(const XalanDOMString& theURI) const = 0;
/**
* Associate a document with a given URI.
@@ -185,8 +171,8 @@
*/
virtual void
setSourceDocument(
- const DOMString& theURI,
- const DOM_Document& theDocument) = 0;
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument) = 0;
/**
* Given a DOM Document, tell what URI was used to parse it. Needed for
@@ -195,15 +181,15 @@
* @param owner source document
* @return document URI
*/
- virtual DOMString
- findURIFromDoc(const DOM_Document& owner) const = 0;
+ virtual XalanDOMString
+ findURIFromDoc(const XalanDocument* owner) const = 0;
/**
* Get a DOM document, primarily for creating result tree fragments.
*
* @return DOM document
*/
- virtual DOM_Document
+ virtual XalanDocument*
getDOMFactory() const = 0;
/**
@@ -215,8 +201,8 @@
*/
virtual bool
functionAvailable(
- const DOMString& theNamespace,
- const DOMString& extensionName) const = 0;
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const = 0;
/**
* Handle an extension function.
@@ -230,9 +216,9 @@
virtual XObject*
extFunction(
XPathExecutionContext&
executionContext,
- const DOMString&
theNamespace,
- const DOMString&
extensionName,
- const std::vector<XObject*>& argVec) const = 0;
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
+ const XObjectArgVectorType& argVec) const =
0;
/**
* Get an XLocator provider keyed by node. This gets the association
@@ -242,7 +228,7 @@
* @return pointer to locator
*/
virtual XLocator*
- getXLocatorFromNode(const DOM_Node& node) const = 0;
+ getXLocatorFromNode(const XalanNode* node) const = 0;
/**
* Associate an XLocator provider to a node. This makes the association
@@ -253,8 +239,8 @@
*/
virtual void
associateXLocatorToNode(
- const DOM_Node& node,
- XLocator* xlocator) const = 0;
+ const XalanNode* node,
+ XLocator* xlocator) = 0;
/**
* Tells, through the combination of the default-space attribute on
@@ -267,7 +253,7 @@
* @return true if the text node should be stripped of extra whitespace
*/
virtual bool
- shouldStripSourceNode(const DOM_Node& node) const = 0;
+ shouldStripSourceNode(const XalanNode& node) const = 0;
enum eSource { eXMLParser = 1,
eXSLTProcessor = 2,
@@ -322,62 +308,40 @@
*/
virtual bool
problem(
- eSource where,
- eClassification classification,
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- int lineNo,
- int charOffset)
const = 0;
-
- /**
- * Function that is called when a problem event occurs.
- *
- * @param where either eXMLParser, eXSLTProcessor,
- * eXPATHParser,
eXPATHProcessor, or eDataSource.
- * @param classification either eWarning, or eError
- * @param resolver resolver for namespace resolution
- * @param styleNode style tree node where the problem occurred
- * (may be null)
- * @param sourceNode source tree node where the problem occurred
- * (may be null)
- * @param msg string message explaining the problem.
- * @param lineNo line number where the problem occurred,
- * if it is known, else zero
- * @param charOffset character offset where the problem,
- * occurred if it is known, else zero
- * @return true if the return is an ERROR, in which case exception will
be
- * thrown. Otherwise the processor will continue to process.
- */
- virtual bool
- problem(
eSource where,
eClassification classification,
- const PrefixResolver* resolver,
- const DOM_Node& sourceNode,
- const DOMString& msg,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
int lineNo,
int
charOffset) const = 0;
- /**
- * Query the value of the extend support instance.
- *
- * @return pointer to the extended support instance, may be 0
- */
- virtual XPathEnvSupport*
- GetExtendedEnvSupport() const = 0;
-
/**
- * This call is intended to allow extending via delegation.
- *
- * @param theExtendedSupport pointer to another XPathEnvSupport
- *
instance to delegate to, may be 0
+ * Function that is called when a problem event occurs.
*
- * @return pointer to the previous extended instance, may be 0
+ * @param where either eXMLParser,
eXSLTProcessor,
+ * eXPATHParser,
eXPATHProcessor, or eDataSource.
+ * @param classification either eWarning, or eError
+ * @param resolver resolver for namespace resolution
+ * @param sourceNode source tree node where the problem occurred
+ * (may be null)
+ * @param msg string message explaining the problem.
+ * @param lineNo line number where the problem occurred,
+ * if it is known, else zero
+ * @param charOffset character offset where the problem,
+ * occurred if it is known, else zero
+ * @return true if the return is an ERROR, in which case exception will
be
+ * thrown. Otherwise the processor will continue to process.
*/
- virtual XPathEnvSupport*
- SetExtendedEnvSupport(XPathEnvSupport* theExtendedSupport) = 0;
-
+ virtual bool
+ problem(
+ eSource where,
+ eClassification classification,
+ const PrefixResolver* resolver,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
+ int lineNo,
+ int
charOffset) const = 0;
// These interfaces are inherited from Resettable...
1.6 +80 -228 xml-xalan/c/src/XPath/XPathEnvSupportDefault.cpp
Index: XPathEnvSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathEnvSupportDefault.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XPathEnvSupportDefault.cpp 2000/03/23 16:45:06 1.5
+++ XPathEnvSupportDefault.cpp 2000/04/11 14:46:16 1.6
@@ -74,15 +74,17 @@
#include "XObjectFactory.hpp"
#include "XPathExecutionContext.hpp"
+
+
#if !defined(XALAN_NO_NAMESPACES)
using std::cerr;
using std::endl;
#endif
+
XPathEnvSupportDefault::XPathEnvSupportDefault() :
XPathEnvSupport(),
- m_extendedSupport(0),
m_sourceDocs()
{
}
@@ -98,111 +100,58 @@
void
XPathEnvSupportDefault::reset()
{
- if (m_extendedSupport != 0)
- {
- m_extendedSupport->reset();
- }
+ m_sourceDocs.clear();
}
const NodeRefListBase*
XPathEnvSupportDefault::getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const DOM_Element& nscontext,
- XPathExecutionContext& executionContext) const
+ const XalanNode& /* doc */,
+ const XalanDOMString& /* name */,
+ const XalanDOMString& /* ref */,
+ const PrefixResolver& /* resolver */,
+ XPathExecutionContext& /* executionContext */) const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->getNodeSetByKey(doc,
-
name,
-
ref,
-
nscontext,
-
executionContext);
- }
- else
- {
- return 0;
- }
+ return 0;
}
-const NodeRefListBase*
-XPathEnvSupportDefault::getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const PrefixResolver& resolver,
- XPathExecutionContext& executionContext) const
-{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->getNodeSetByKey(doc,
-
name,
-
ref,
-
resolver,
-
executionContext);
- }
- else
- {
- return 0;
- }
-}
-
-
-
XObject*
XPathEnvSupportDefault::getVariable(
XObjectFactory& xobjectFactory,
const QName& name) const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->getVariable(xobjectFactory,
-
name);
- }
- else
- {
- return xobjectFactory.createUnknown(name.getLocalPart());
- }
+ return xobjectFactory.createUnknown(name.getLocalPart());
}
-DOM_Document
+XalanDocument*
XPathEnvSupportDefault::parseXML(
- const DOMString& /* urlString */,
- const DOMString& /* base */) const
+ const XalanDOMString& /* urlString */,
+ const XalanDOMString& /* base */)
{
- return DOM_Document();
+ return 0;
}
-DOM_Document
-XPathEnvSupportDefault::getSourceDocument(const DOMString& theURI) const
+XalanDocument*
+XPathEnvSupportDefault::getSourceDocument(const XalanDOMString&
theURI) const
{
- if (m_extendedSupport != 0)
+ const SourceDocsTableType::const_iterator i =
+ m_sourceDocs.find(theURI);
+
+ if (i == m_sourceDocs.end())
{
- return m_extendedSupport->getSourceDocument(theURI);
+ return 0;
}
else
{
- const SourceDocsTableType::const_iterator i =
- m_sourceDocs.find(theURI);
-
- if (i == m_sourceDocs.end())
- {
- return DOM_Document();
- }
- else
- {
- return i->second;
- }
+ return i->second;
}
}
@@ -210,82 +159,53 @@
void
XPathEnvSupportDefault::setSourceDocument(
- const DOMString& theURI,
- const DOM_Document& theDocument)
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument)
{
- if (m_extendedSupport != 0)
- {
- m_extendedSupport->setSourceDocument(theURI, theDocument);
- }
- else
- {
- m_sourceDocs[theURI] = theDocument;
- }
+ m_sourceDocs[theURI] = theDocument;
}
-DOMString
-XPathEnvSupportDefault::findURIFromDoc(const DOM_Document& owner) const
+XalanDOMString
+XPathEnvSupportDefault::findURIFromDoc(const XalanDocument* owner)
const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->findURIFromDoc(owner);
- }
- else
- {
- SourceDocsTableType::const_iterator i =
+ SourceDocsTableType::const_iterator i =
m_sourceDocs.begin();
- bool fFound = false;
+ bool fFound = false;
- while(i != m_sourceDocs.end() && fFound == false)
+ while(i != m_sourceDocs.end() && fFound == false)
+ {
+ if (i->second == owner)
{
- if (i->second == owner)
- {
- fFound = true;
- }
- else
- {
- ++i;
- }
+ fFound = true;
}
-
- return fFound == false ? "Unknown" : i->first;
+ else
+ {
+ ++i;
+ }
}
+
+ return fFound == false ? XalanDOMString() : i->first;
}
-DOM_Document
+XalanDocument*
XPathEnvSupportDefault::getDOMFactory() const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->getDOMFactory();
- }
- else
- {
- return DOM_Document();
- }
+ return 0;
}
bool
XPathEnvSupportDefault::functionAvailable(
- const DOMString& theNamespace,
- const DOMString& extensionName) const
+ const XalanDOMString& /* theNamespace */,
+ const XalanDOMString& /* extensionName */) const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->functionAvailable(theNamespace,
-
extensionName);
- }
- else
- {
- return false;
- }
+ return false;
}
@@ -293,146 +213,78 @@
XObject*
XPathEnvSupportDefault::extFunction(
XPathExecutionContext&
executionContext,
- const DOMString&
theNamespace,
- const DOMString&
extensionName,
- const XObjectPtrVectorType& argVec) const
+ const XalanDOMString& /* theNamespace
*/,
+ const XalanDOMString& /*
extensionName */,
+ const XObjectArgVectorType& /* argVec */)
const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->extFunction(executionContext,
-
theNamespace,
-
extensionName,
-
argVec);
- }
- else
- {
- return executionContext.getXObjectFactory().createNull();
- }
+ return executionContext.getXObjectFactory().createNull();
}
XLocator*
-XPathEnvSupportDefault::getXLocatorFromNode(const DOM_Node& node) const
+XPathEnvSupportDefault::getXLocatorFromNode(const XalanNode* /* node */)
const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->getXLocatorFromNode(node);
- }
- else
- {
- return SimpleNodeLocator::getDefaultInstance();
- }
+ return SimpleNodeLocator::getDefaultInstance();
}
void
XPathEnvSupportDefault::associateXLocatorToNode(
- const DOM_Node& node,
- XLocator* xlocator) const
+ const XalanNode* /* node */,
+ XLocator* /* xlocator */)
{
- if (m_extendedSupport != 0)
- {
- m_extendedSupport->associateXLocatorToNode(node,
-
xlocator);
- }
}
bool
-XPathEnvSupportDefault::shouldStripSourceNode(const DOM_Node& node)
const
+XPathEnvSupportDefault::shouldStripSourceNode(const XalanNode& /* node
*/) const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->shouldStripSourceNode(node);
- }
- else
- {
- return false;
- }
+ return false;
}
bool
XPathEnvSupportDefault::problem(
- eSource where,
- eClassification classification,
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- int lineNo,
- int charOffset)
const
+ eSource /* where */,
+ eClassification classification,
+ const XalanNode* /* styleNode */,
+ const XalanNode* /* sourceNode */,
+ const XalanDOMString& msg,
+ int lineNo,
+ int
charOffset) const
{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->problem(where,
-
classification,
-
styleNode,
-
sourceNode,
-
msg,
-
lineNo,
-
charOffset);
- }
- else
- {
- cerr << msg
- << ", at line number "
- << static_cast<long>(lineNo)
- << " at offset "
- << static_cast<long>(charOffset)
- << endl;
+ cerr << msg
+ << ", at line number "
+ << static_cast<long>(lineNo)
+ << " at offset "
+ << static_cast<long>(charOffset)
+ << endl;
- return classification == XPathEnvSupport::eError ? true : false;
- }
+ return classification == XPathEnvSupport::eError ? true : false;
}
bool
XPathEnvSupportDefault::problem(
- eSource where,
+ eSource /* where */,
eClassification classification,
- const PrefixResolver* resolver,
- const DOM_Node& sourceNode,
- const DOMString& msg,
+ const PrefixResolver* /* resolver */,
+ const XalanNode* /* sourceNode */,
+ const XalanDOMString& msg,
int lineNo,
int
charOffset) const
-{
- if (m_extendedSupport != 0)
- {
- return m_extendedSupport->problem(where,
-
classification,
-
resolver,
-
sourceNode,
-
msg,
-
lineNo,
-
charOffset);
- }
- else
- {
- return classification == XPathEnvSupport::eError ? true :false;
- }
-}
-
-
-
-XPathEnvSupport*
-XPathEnvSupportDefault::GetExtendedEnvSupport() const
{
- return m_extendedSupport;
-}
-
-
-
-XPathEnvSupport*
-XPathEnvSupportDefault::SetExtendedEnvSupport(XPathEnvSupport*
theExtendedSupport)
-{
- XPathEnvSupport* const theOldSupport = m_extendedSupport;
-
- m_extendedSupport = theExtendedSupport;
+ cerr << msg
+ << ", at line number "
+ << static_cast<long>(lineNo)
+ << " at offset "
+ << static_cast<long>(charOffset)
+ << endl;
- return theOldSupport;
+ return classification == XPathEnvSupport::eError ? true :false;
}
1.6 +38 -56 xml-xalan/c/src/XPath/XPathEnvSupportDefault.hpp
Index: XPathEnvSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathEnvSupportDefault.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XPathEnvSupportDefault.hpp 2000/03/23 16:45:06 1.5
+++ XPathEnvSupportDefault.hpp 2000/04/11 14:46:17 1.6
@@ -80,15 +80,6 @@
{
public:
-#if defined(XALAN_NO_NAMESPACES)
- typedef vector<XObject*> XObjectPtrVectorType;
- typedef map<DOMString, DOM_Document> SourceDocsTableType;
-#else
- typedef std::vector<XObject*> XObjectPtrVectorType;
- typedef std::map<DOMString, DOM_Document> SourceDocsTableType;
-#endif
-
-
XPathEnvSupportDefault();
virtual
@@ -98,17 +89,9 @@
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const DOM_Element& nscontext,
- XPathExecutionContext& executionContext) const;
-
- virtual const NodeRefListBase*
- getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
const PrefixResolver& resolver,
XPathExecutionContext& executionContext) const;
@@ -117,75 +100,69 @@
XObjectFactory& factory,
const QName& name) const;
- virtual DOM_Document
+ virtual XalanDocument*
parseXML(
- const DOMString& urlString,
- const DOMString& base) const;
+ const XalanDOMString& urlString,
+ const XalanDOMString& base);
- virtual DOM_Document
- getSourceDocument(const DOMString& theURI) const;
+ virtual XalanDocument*
+ getSourceDocument(const XalanDOMString& theURI) const;
virtual void
setSourceDocument(
- const DOMString& theURI,
- const DOM_Document& theDocument);
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument);
- virtual DOMString
- findURIFromDoc(const DOM_Document& owner) const;
+ virtual XalanDOMString
+ findURIFromDoc(const XalanDocument* owner) const;
- virtual DOM_Document
+ virtual XalanDocument*
getDOMFactory() const;
virtual bool
functionAvailable(
- const DOMString& theNamespace,
- const DOMString& extensionName) const;
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const;
// $$$ ToDo: How do we implement this?
virtual XObject*
extFunction(
XPathExecutionContext&
executionContext,
- const DOMString&
theNamespace,
- const DOMString&
extensionName,
- const std::vector<XObject*>& argVec) const;
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
+ const XObjectArgVectorType& argVec) const;
virtual XLocator*
- getXLocatorFromNode(const DOM_Node& node) const;
+ getXLocatorFromNode(const XalanNode* node) const;
virtual void
associateXLocatorToNode(
- const DOM_Node& node,
- XLocator* xlocator) const;
+ const XalanNode* node,
+ XLocator* xlocator);
virtual bool
- shouldStripSourceNode(const DOM_Node& node) const;
+ shouldStripSourceNode(const XalanNode& node) const;
virtual bool
problem(
- eSource where,
- eClassification classification,
- const DOM_Node& styleNode,
- const DOM_Node& sourceNode,
- const DOMString& msg,
- int lineNo,
- int charOffset)
const;
+ eSource where,
+ eClassification classification,
+ const XalanNode* styleNode,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
+ int lineNo,
+ int
charOffset) const;
virtual bool
problem(
eSource where,
eClassification classification,
const PrefixResolver* resolver,
- const DOM_Node& sourceNode,
- const DOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanDOMString& msg,
int lineNo,
int
charOffset) const;
- virtual XPathEnvSupport*
- GetExtendedEnvSupport() const;
-
- virtual XPathEnvSupport*
- SetExtendedEnvSupport(XPathEnvSupport* theExtendedSupport);
-
// These interfaces are inherited from Resettable...
virtual void
@@ -204,10 +181,15 @@
// Data members...
- XPathEnvSupport* m_extendedSupport;
-
// Table for storing source tree documents, which are keyed by
// URL.
+
+#if defined(XALAN_NO_NAMESPACES)
+ typedef map<XalanDOMString, XalanDocument*>
SourceDocsTableType;
+#else
+ typedef std::map<XalanDOMString, XalanDocument*>
SourceDocsTableType;
+#endif
+
SourceDocsTableType m_sourceDocs;
};
1.2 +2 -3 xml-xalan/c/src/XPath/XPathException.cpp
Index: XPathException.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathException.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XPathException.cpp 1999/12/18 19:47:55 1.1
+++ XPathException.cpp 2000/04/11 14:46:17 1.2
@@ -59,10 +59,9 @@
-
XPathException::XPathException(
- const DOMString& message,
- const DOM_Node& styleNode) :
+ const XalanDOMString& message,
+ const XalanNode* styleNode) :
XSLException(message),
m_styleNode(styleNode)
{
1.3 +14 -5 xml-xalan/c/src/XPath/XPathException.hpp
Index: XPathException.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathException.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPathException.hpp 2000/03/03 19:00:20 1.2
+++ XPathException.hpp 2000/04/11 14:46:17 1.3
@@ -64,8 +64,7 @@
-#include <dom/DOMString.hpp>
-#include <dom/DOM_Node.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -74,6 +73,10 @@
+class XalanNode;
+
+
+
class XALAN_XPATH_EXPORT XPathException : public XSLException
{
public:
@@ -86,15 +89,21 @@
*/
explicit
XPathException(
- const DOMString& message = DOMString(),
- const DOM_Node& styleNode = DOM_Node());
+ const XalanDOMString& message = XalanDOMString(),
+ const XalanNode* styleNode = 0);
virtual
~XPathException();
+ const XalanNode*
+ getStyleNode() const
+ {
+ return m_styleNode;
+ }
+
private:
- const DOM_Node m_styleNode;
+ const XalanNode* m_styleNode;
};
1.5 +74 -62 xml-xalan/c/src/XPath/XPathExecutionContext.hpp
Index: XPathExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContext.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathExecutionContext.hpp 2000/03/03 19:00:20 1.4
+++ XPathExecutionContext.hpp 2000/04/11 14:46:17 1.5
@@ -68,25 +68,29 @@
-#include <dom/DOMString.hpp>
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Element.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
// Base class header file...
#include <PlatformSupport/ExecutionContext.hpp>
+
+
#include <XPath/MutableNodeRefList.hpp>
+class DecimalFormatSymbols;
class PrefixResolver;
class QName;
class XLocator;
class XMLURL;
class XObject;
class XObjectFactory;
+class XalanDocument;
+class XalanNode;
+class XalanElement;
@@ -110,7 +114,7 @@
*
* @return current node
*/
- virtual DOM_Node
+ virtual XalanNode*
getCurrentNode() const = 0;
/**
@@ -119,7 +123,7 @@
* @param theCurrentNode new current node
*/
virtual void
- setCurrentNode(const DOM_Node& theCurrentNode) = 0;
+ setCurrentNode(XalanNode* theCurrentNode) = 0;
/**
* Retrieve the factory object for creating XObjects.
@@ -135,8 +139,8 @@
* @param n DOM node queried
* @return namespace string corresponding to 'n'
*/
- virtual DOMString
- getNamespaceOfNode(const DOM_Node& n) const = 0;
+ virtual XalanDOMString
+ getNamespaceOfNode(const XalanNode& n) const = 0;
/**
* Returns the local name of the given node.
@@ -144,8 +148,8 @@
* @param n node queried
* @return local name string corresponding to 'n'
*/
- virtual DOMString
- getLocalNameOfNode(const DOM_Node& n) const = 0;
+ virtual XalanDOMString
+ getLocalNameOfNode(const XalanNode& n) const = 0;
/**
* Returns the parent of the given node.
@@ -153,8 +157,8 @@
* @param n DOM node queried
* @return parent node for 'n'
*/
- virtual DOM_Node
- getParentOfNode(const DOM_Node& n) const = 0;
+ virtual XalanNode*
+ getParentOfNode(const XalanNode& n) const = 0;
/**
* Get node data recursively.
@@ -163,8 +167,8 @@
* @param n DOM node queried
* @return string of data for node 'n'
*/
- virtual DOMString
- getNodeData(const DOM_Node& n) const = 0;
+ virtual XalanDOMString
+ getNodeData(const XalanNode& n) const = 0;
/**
* Given a valid element id, return the corresponding element.
@@ -173,10 +177,10 @@
* @param doc document to search
* @return element for ID
*/
- virtual DOM_Element
+ virtual XalanElement*
getElementByID(
- const DOMString& id,
- const DOM_Document& doc) const = 0;
+ const XalanDOMString& id,
+ const XalanDocument& doc) const = 0;
/**
* Retrieve node list for current context.
@@ -208,7 +212,7 @@
* @return position in list
*/
virtual int
- getContextNodeListPosition(const DOM_Node& contextNode) const = 0;
+ getContextNodeListPosition(const XalanNode& contextNode)
const = 0;
/**
* Determine if an external function is available.
@@ -219,8 +223,8 @@
*/
virtual bool
functionAvailable(
- const DOMString& theNamespace,
- const DOMString& extensionName) const = 0;
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const = 0;
/**
* Handle an extension function.
@@ -232,8 +236,8 @@
*/
virtual XObject*
extFunction(
- const DOMString&
theNamespace,
- const DOMString&
extensionName,
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
const std::vector<XObject*>& argVec) = 0;
/**
@@ -244,7 +248,7 @@
* @return pointer to locator
*/
virtual XLocator*
- getXLocatorFromNode(const DOM_Node& node) const = 0;
+ getXLocatorFromNode(const XalanNode* node) const = 0;
/**
* Associate an XLocator provider to a node. This makes the association
@@ -255,7 +259,7 @@
*/
virtual void
associateXLocatorToNode(
- const DOM_Node& node,
+ const XalanNode* node,
XLocator* xlocator) = 0;
/**
@@ -265,10 +269,10 @@
* @param base base location for URI
* @return parsed document
*/
- virtual DOM_Document
+ virtual XalanDocument*
parseXML(
- const DOMString& urlString,
- const DOMString& base) const = 0;
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) const = 0;
/**
* Create a MutableNodeRefList with the appropriate context.
@@ -301,10 +305,10 @@
*/
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const DOM_Element& nscontext) = 0;
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const XalanElement& nscontext) = 0;
/**
* Given a valid element key, return the corresponding node list.
@@ -320,9 +324,9 @@
*/
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref) = 0;
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref) = 0;
/**
* Given a valid element key, return the corresponding node list.
@@ -339,9 +343,9 @@
*/
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
const PrefixResolver& resolver) = 0;
/**
@@ -352,8 +356,7 @@
* @return pointer to an XObject if the variable was found, 0 if it was
not
*/
virtual XObject*
- getVariable(
- const QName& name) const = 0;
+ getVariable(const QName& name) const = 0;
/**
* Retrieve the resolver for namespaces.
@@ -377,8 +380,8 @@
* @param prefix prefix for a namespace
* @return URI corresponding to namespace
*/
- virtual DOMString
- getNamespaceForPrefix(const DOMString& prefix) const = 0;
+ virtual XalanDOMString
+ getNamespaceForPrefix(const XalanDOMString& prefix) const =
0;
/**
* Given a DOM Document, tell what URI was used to parse it. Needed for
@@ -387,8 +390,8 @@
* @param owner source document
* @return document URI
*/
- virtual DOMString
- findURIFromDoc(const DOM_Document& owner) const = 0;
+ virtual XalanDOMString
+ findURIFromDoc(const XalanDocument* owner) const = 0;
/**
* The getUnparsedEntityURI function returns the URI of the unparsed
@@ -400,10 +403,10 @@
* @param theDocument document containing entity
* @return URI for the entity
*/
- virtual DOMString
+ virtual XalanDOMString
getUnparsedEntityURI(
- const DOMString& theName,
- const DOM_Document& theDocument) const = 0;
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const = 0;
/**
* Tells, through the combination of the default-space attribute
@@ -416,7 +419,7 @@
* @return true if the text node should be stripped of extra whitespace
*/
virtual bool
- shouldStripSourceNode(const DOM_Node& node) const = 0;
+ shouldStripSourceNode(const XalanNode& node) const = 0;
/**
* Tells if FoundIndex should be thrown if index is found. This is an
@@ -444,18 +447,18 @@
* @param thePattern new match pattern
*/
virtual void
- setCurrentPattern(const DOMString& thePattern) = 0;
+ setCurrentPattern(const XalanDOMString& thePattern) = 0;
/**
* Retrieve the current match pattern.
*
* @return current match pattern
*/
- virtual DOMString
+ virtual XalanDOMString
getCurrentPattern() const = 0;
- virtual DOM_Document
- getSourceDocument(const DOMString& theURI) const = 0;
+ virtual XalanDocument*
+ getSourceDocument(const XalanDOMString& theURI) const = 0;
/**
* Associate a document with a given URI.
@@ -465,30 +468,39 @@
*/
virtual void
setSourceDocument(
- const DOMString& theURI,
- const DOM_Document& theDocument) = 0;
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument) = 0;
+ /**
+ * Retrieve the DecimalFormatSymbols instance associated with
+ * the name.
+ *
+ * @param name the name for the lookup
+ * @return a pointer to the matching instance, or 0 if none was found
+ */
+ virtual const DecimalFormatSymbols*
+ getDecimalFormatSymbols(const XalanDOMString& name) = 0;
+
// These interfaces are inherited from ExecutionContext...
virtual void
error(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const =
0;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const =
0;
virtual void
warn(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const =
0;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const =
0;
virtual void
message(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const =
0;
-
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const =
0;
};
1.3 +83 -78 xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp
Index: XPathExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPathExecutionContextDefault.cpp 2000/02/17 20:29:53 1.2
+++ XPathExecutionContextDefault.cpp 2000/04/11 14:46:18 1.3
@@ -72,7 +72,7 @@
XPathEnvSupport& theXPathEnvSupport,
XPathSupport& theXPathSupport,
XObjectFactory& theXObjectFactory,
- const DOM_Node& theCurrentNode,
+ XalanNode* theCurrentNode,
const NodeRefListBase& theContextNodeList,
const PrefixResolver* thePrefixResolver) :
XPathExecutionContext(),
@@ -94,7 +94,7 @@
-DOM_Node
+XalanNode*
XPathExecutionContextDefault::getCurrentNode() const
{
return m_currentNode;
@@ -103,7 +103,7 @@
void
-XPathExecutionContextDefault::setCurrentNode(const DOM_Node& theCurrentNode)
+XPathExecutionContextDefault::setCurrentNode(XalanNode*
theCurrentNode)
{
m_currentNode = theCurrentNode;
}
@@ -118,42 +118,42 @@
-DOMString
-XPathExecutionContextDefault::getNamespaceOfNode(const DOM_Node& n) const
+XalanDOMString
+XPathExecutionContextDefault::getNamespaceOfNode(const XalanNode& n) const
{
return m_xpathSupport.getNamespaceOfNode(n);
}
-DOMString
-XPathExecutionContextDefault::getLocalNameOfNode(const DOM_Node& n) const
+XalanDOMString
+XPathExecutionContextDefault::getLocalNameOfNode(const XalanNode& n) const
{
return m_xpathSupport.getLocalNameOfNode(n);
}
-DOM_Node
-XPathExecutionContextDefault::getParentOfNode(const DOM_Node& n) const
+XalanNode*
+XPathExecutionContextDefault::getParentOfNode(const XalanNode& n) const
{
return m_xpathSupport.getParentOfNode(n);
}
-DOMString
-XPathExecutionContextDefault::getNodeData(const DOM_Node& n) const
+XalanDOMString
+XPathExecutionContextDefault::getNodeData(const XalanNode& n) const
{
return m_xpathSupport.getNodeData(n);
}
-DOM_Element
+XalanElement*
XPathExecutionContextDefault::getElementByID(
- const DOMString& id,
- const DOM_Document& doc) const
+ const XalanDOMString& id,
+ const XalanDocument& doc) const
{
return m_xpathSupport.getElementByID(id, doc);
}
@@ -190,10 +190,8 @@
int
-XPathExecutionContextDefault::getContextNodeListPosition(const DOM_Node&
contextNode) const
+XPathExecutionContextDefault::getContextNodeListPosition(const XalanNode&
contextNode) const
{
- assert(contextNode != 0);
-
if (m_throwFoundIndex == true)
{
throw FoundIndex();
@@ -205,7 +203,7 @@
for(int i = 0; i < nNodes; i++)
{
- if(m_contextNodeList.item(i) == contextNode)
+ if(m_contextNodeList.item(i) == &contextNode)
{
pos = i + 1; // for 1-based XSL count.
@@ -220,8 +218,8 @@
bool
XPathExecutionContextDefault::functionAvailable(
- const DOMString& theNamespace,
- const DOMString& extensionName) const
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const
{
return m_xpathEnvSupport.functionAvailable(theNamespace, extensionName);
}
@@ -230,8 +228,8 @@
XObject*
XPathExecutionContextDefault::extFunction(
- const DOMString&
theNamespace,
- const DOMString&
extensionName,
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
const std::vector<XObject*>& argVec)
{
return m_xpathEnvSupport.extFunction(*this, theNamespace,
extensionName, argVec);
@@ -240,7 +238,7 @@
XLocator*
-XPathExecutionContextDefault::getXLocatorFromNode(const DOM_Node&
node) const
+XPathExecutionContextDefault::getXLocatorFromNode(const XalanNode* node)
const
{
return m_xpathEnvSupport.getXLocatorFromNode(node);
}
@@ -249,7 +247,7 @@
void
XPathExecutionContextDefault::associateXLocatorToNode(
- const DOM_Node& node,
+ const XalanNode* node,
XLocator* xlocator)
{
m_xpathEnvSupport.associateXLocatorToNode(node, xlocator);
@@ -257,10 +255,10 @@
-DOM_Document
+XalanDocument*
XPathExecutionContextDefault::parseXML(
- const DOMString& urlString,
- const DOMString& base) const
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) const
{
return m_xpathEnvSupport.parseXML(urlString, base);
}
@@ -285,24 +283,24 @@
const NodeRefListBase*
XPathExecutionContextDefault::getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const DOM_Element& nscontext)
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const XalanElement& nscontext)
{
return getNodeSetByKey(doc,
name,
ref,
-
ElementPrefixResolverProxy(nscontext, m_xpathEnvSupport, m_xpathSupport));
+
ElementPrefixResolverProxy(&nscontext, m_xpathEnvSupport, m_xpathSupport));
}
const NodeRefListBase*
XPathExecutionContextDefault::getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref)
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref)
{
assert(m_prefixResolver != 0);
@@ -316,9 +314,9 @@
const NodeRefListBase*
XPathExecutionContextDefault::getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
const PrefixResolver& resolver)
{
return m_xpathEnvSupport.getNodeSetByKey(doc,
@@ -331,8 +329,7 @@
XObject*
-XPathExecutionContextDefault::getVariable(
- const QName& name) const
+XPathExecutionContextDefault::getVariable(const QName& name) const
{
return m_xpathEnvSupport.getVariable(m_xobjectFactory, name);
}
@@ -355,8 +352,8 @@
-DOMString
-XPathExecutionContextDefault::getNamespaceForPrefix(const DOMString& prefix)
const
+XalanDOMString
+XPathExecutionContextDefault::getNamespaceForPrefix(const XalanDOMString&
prefix) const
{
assert(m_prefixResolver != 0);
@@ -365,18 +362,18 @@
-DOMString
-XPathExecutionContextDefault::findURIFromDoc(const DOM_Document& owner)
const
+XalanDOMString
+XPathExecutionContextDefault::findURIFromDoc(const XalanDocument* owner)
const
{
return m_xpathEnvSupport.findURIFromDoc(owner);
}
-DOMString
+XalanDOMString
XPathExecutionContextDefault::getUnparsedEntityURI(
- const DOMString& theName,
- const DOM_Document& theDocument) const
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const
{
return m_xpathSupport.getUnparsedEntityURI(theName, theDocument);
}
@@ -384,7 +381,7 @@
bool
-XPathExecutionContextDefault::shouldStripSourceNode(const DOM_Node& node)
const
+XPathExecutionContextDefault::shouldStripSourceNode(const XalanNode& node)
const
{
return m_xpathEnvSupport.shouldStripSourceNode(node);
}
@@ -393,19 +390,19 @@
void
XPathExecutionContextDefault::error(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& /* styleNode */) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* /* styleNode */) const
{
- DOMString emsg;
+ XalanDOMString emsg;
- const DOMString theCurrentPattern(getCurrentPattern());
+ const XalanDOMString theCurrentPattern(getCurrentPattern());
if (length(theCurrentPattern) != 0)
{
- emsg = DOMString("pattern = '") +
+ emsg = XalanDOMString("pattern = '") +
theCurrentPattern +
- DOMString("'\n");
+ XalanDOMString("'\n");
}
emsg += msg;
@@ -419,7 +416,7 @@
0) == true)
{
// $$$ ToDo: Do something with the PrefixResolver here...
- throw XPathException(msg, DOM_Node());
+ throw XPathException(emsg, 0);
}
}
@@ -427,19 +424,19 @@
void
XPathExecutionContextDefault::warn(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& /* styleNode */) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* /* styleNode */) const
{
- DOMString emsg;
+ XalanDOMString emsg;
- const DOMString theCurrentPattern(getCurrentPattern());
+ const XalanDOMString theCurrentPattern(getCurrentPattern());
if (length(theCurrentPattern) != 0)
{
- emsg = DOMString("pattern = '") +
+ emsg = XalanDOMString("pattern = '") +
theCurrentPattern +
- DOMString("'\n");
+ XalanDOMString("'\n");
}
emsg += msg;
@@ -453,7 +450,7 @@
0) == true)
{
// $$$ ToDo: Do something with the PrefixResolver here...
- throw XPathException(msg, DOM_Node());
+ throw XPathException(msg, 0);
}
}
@@ -461,19 +458,19 @@
void
XPathExecutionContextDefault::message(
- const DOMString& msg,
- const DOM_Node& sourceNode,
- const DOM_Node& /* styleNode */) const
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode,
+ const XalanNode* /* styleNode */) const
{
- DOMString emsg;
+ XalanDOMString emsg;
- const DOMString theCurrentPattern(getCurrentPattern());
+ const XalanDOMString theCurrentPattern(getCurrentPattern());
if (length(theCurrentPattern) != 0)
{
- emsg = DOMString("pattern = '") +
+ emsg = XalanDOMString("pattern = '") +
theCurrentPattern +
- DOMString("'\n");
+ XalanDOMString("'\n");
}
emsg += msg;
@@ -487,7 +484,7 @@
0) == true)
{
// $$$ ToDo: Do something with the PrefixResolver here...
- throw XPathException(msg, DOM_Node());
+ throw XPathException(msg);
}
}
@@ -509,13 +506,13 @@
void
-XPathExecutionContextDefault::setCurrentPattern(const DOMString&
thePattern)
+XPathExecutionContextDefault::setCurrentPattern(const XalanDOMString&
thePattern)
{
m_currentPattern = thePattern;
}
-DOMString
+XalanDOMString
XPathExecutionContextDefault::getCurrentPattern() const
{
return m_currentPattern;
@@ -523,8 +520,8 @@
-DOM_Document
-XPathExecutionContextDefault::getSourceDocument(const DOMString& theURI)
const
+XalanDocument*
+XPathExecutionContextDefault::getSourceDocument(const XalanDOMString&
theURI) const
{
return m_xpathEnvSupport.getSourceDocument(theURI);
}
@@ -533,8 +530,16 @@
void
XPathExecutionContextDefault::setSourceDocument(
- const DOMString& theURI,
- const DOM_Document& theDocument)
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument)
{
m_xpathEnvSupport.setSourceDocument(theURI, theDocument);
+}
+
+
+
+const DecimalFormatSymbols*
+XPathExecutionContextDefault::getDecimalFormatSymbols(const XalanDOMString&
name)
+{
+ return 0;
}
1.5 +64 -61 xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp
Index: XPathExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathExecutionContextDefault.hpp 2000/03/08 20:58:32 1.4
+++ XPathExecutionContextDefault.hpp 2000/04/11 14:46:18 1.5
@@ -67,7 +67,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -100,7 +100,7 @@
XPathEnvSupport& theXPathEnvSupport,
XPathSupport& theXPathSupport,
XObjectFactory& theXObjectFactory,
- const DOM_Node& theCurrentNode =
DOM_Node(),
+ XalanNode* theCurrentNode
= 0,
const NodeRefListBase& theContextNodeList =
NodeRefList(),
const PrefixResolver* thePrefixResolver = 0);
@@ -110,31 +110,31 @@
// These interfaces are inherited from XPathExecutionContext...
- virtual DOM_Node
+ virtual XalanNode*
getCurrentNode() const;
virtual void
- setCurrentNode(const DOM_Node& theCurrentNode);
+ setCurrentNode(XalanNode* theCurrentNode);
virtual XObjectFactory&
getXObjectFactory() const;
- virtual DOMString
- getNamespaceOfNode(const DOM_Node& n) const;
+ virtual XalanDOMString
+ getNamespaceOfNode(const XalanNode& n) const;
- virtual DOMString
- getLocalNameOfNode(const DOM_Node& n) const;
+ virtual XalanDOMString
+ getLocalNameOfNode(const XalanNode& n) const;
- virtual DOM_Node
- getParentOfNode(const DOM_Node& n) const;
+ virtual XalanNode*
+ getParentOfNode(const XalanNode& n) const;
- virtual DOMString
- getNodeData(const DOM_Node& n) const;
+ virtual XalanDOMString
+ getNodeData(const XalanNode& n) const;
- virtual DOM_Element
+ virtual XalanElement*
getElementByID(
- const DOMString& id,
- const DOM_Document& doc) const;
+ const XalanDOMString& id,
+ const XalanDocument& doc) const;
virtual const NodeRefListBase&
getContextNodeList() const;
@@ -146,31 +146,31 @@
getContextNodeListLength() const;
virtual int
- getContextNodeListPosition(const DOM_Node& contextNode) const;
+ getContextNodeListPosition(const XalanNode& contextNode)
const;
virtual bool
functionAvailable(
- const DOMString& theNamespace,
- const DOMString& extensionName) const;
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName) const;
virtual XObject*
extFunction(
- const DOMString&
theNamespace,
- const DOMString&
extensionName,
+ const XalanDOMString& theNamespace,
+ const XalanDOMString& extensionName,
const std::vector<XObject*>& argVec);
virtual XLocator*
- getXLocatorFromNode(const DOM_Node& node) const;
+ getXLocatorFromNode(const XalanNode* node) const;
virtual void
associateXLocatorToNode(
- const DOM_Node& node,
+ const XalanNode* node,
XLocator* xlocator);
- virtual DOM_Document
+ virtual XalanDocument*
parseXML(
- const DOMString& urlString,
- const DOMString& base) const;
+ const XalanDOMString& urlString,
+ const XalanDOMString& base) const;
virtual MutableNodeRefList
createMutableNodeRefList() const;
@@ -180,27 +180,27 @@
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
- const DOM_Element& nscontext);
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
+ const XalanElement& nscontext);
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref);
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref);
virtual const NodeRefListBase*
getNodeSetByKey(
- const DOM_Node& doc,
- const DOMString& name,
- const DOMString& ref,
+ const XalanNode& doc,
+ const XalanDOMString& name,
+ const XalanDOMString& ref,
const PrefixResolver& resolver);
virtual XObject*
getVariable(
- const QName& name) const;
+ const QName& name) const;
virtual const PrefixResolver*
getPrefixResolver() const;
@@ -208,19 +208,19 @@
virtual void
setPrefixResolver(const PrefixResolver* thePrefixResolver);
- virtual DOMString
- getNamespaceForPrefix(const DOMString& prefix) const;
+ virtual XalanDOMString
+ getNamespaceForPrefix(const XalanDOMString& prefix) const;
- virtual DOMString
- findURIFromDoc(const DOM_Document& owner) const;
+ virtual XalanDOMString
+ findURIFromDoc(const XalanDocument* owner) const;
- virtual DOMString
+ virtual XalanDOMString
getUnparsedEntityURI(
- const DOMString& theName,
- const DOM_Document& theDocument) const;
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const;
virtual bool
- shouldStripSourceNode(const DOM_Node& node) const;
+ shouldStripSourceNode(const XalanNode& node) const;
virtual bool
getThrowFoundIndex() const;
@@ -229,39 +229,42 @@
setThrowFoundIndex(bool fThrow);
virtual void
- setCurrentPattern(const DOMString& thePattern);
+ setCurrentPattern(const XalanDOMString& thePattern);
- virtual DOMString
+ virtual XalanDOMString
getCurrentPattern() const;
- virtual DOM_Document
- getSourceDocument(const DOMString& theURI) const;
+ virtual XalanDocument*
+ getSourceDocument(const XalanDOMString& theURI) const;
virtual void
setSourceDocument(
- const DOMString& theURI,
- const DOM_Document& theDocument);
+ const XalanDOMString& theURI,
+ XalanDocument* theDocument);
+ virtual const DecimalFormatSymbols*
+ getDecimalFormatSymbols(const XalanDOMString& name);
+
// These interfaces are inherited from ExecutionContext...
virtual void
error(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
virtual void
warn(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
virtual void
message(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node(),
- const DOM_Node& styleNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ const XalanNode* sourceNode = 0,
+ const XalanNode* styleNode = 0) const;
private:
@@ -271,7 +274,7 @@
XObjectFactory& m_xobjectFactory;
- DOM_Node m_currentNode;
+ XalanNode* m_currentNode;
MutableNodeRefList m_contextNodeList;
@@ -279,7 +282,7 @@
bool m_throwFoundIndex;
- DOMString m_currentPattern;
+ XalanDOMString m_currentPattern;
};
1.4 +4 -1 xml-xalan/c/src/XPath/XPathExpression.cpp
Index: XPathExpression.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XPathExpression.cpp 2000/03/20 14:33:39 1.3
+++ XPathExpression.cpp 2000/04/11 14:46:18 1.4
@@ -210,9 +210,11 @@
m_lastOpCodeIndex(0),
m_tokenQueue(),
m_currentPosition(0),
- m_patternMap(200),
+ m_patternMap(100),
m_currentPattern()
{
+ m_opMap.reserve(100);
+ m_tokenQueue.reserve(100);
}
@@ -237,6 +239,7 @@
XPathExpression::shrink()
{
m_opMap = OpCodeMapType(m_opMap);
+ TokenQueueType(m_tokenQueue).swap(m_tokenQueue);
m_patternMap = PatternMapType(m_patternMap);
}
1.3 +4 -4 xml-xalan/c/src/XPath/XPathExpression.hpp
Index: XPathExpression.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPathExpression.hpp 2000/03/03 19:00:20 1.2
+++ XPathExpression.hpp 2000/04/11 14:46:18 1.3
@@ -70,7 +70,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -1217,7 +1217,7 @@
* @param thePattern match pattern to make current
*/
void
- setCurrentPattern(const DOMString& thePattern)
+ setCurrentPattern(const XalanDOMString& thePattern)
{
m_currentPattern = thePattern;
}
@@ -1227,7 +1227,7 @@
*
* @return string for current match pattern
*/
- const DOMString&
+ const XalanDOMString&
getCurrentPattern() const
{
return m_currentPattern;
@@ -1272,7 +1272,7 @@
/**
* The current pattern string, for diagnostics purposes.
*/
- DOMString m_currentPattern;
+ XalanDOMString m_currentPattern;
private:
1.4 +0 -2 xml-xalan/c/src/XPath/XPathFactory.hpp
Index: XPathFactory.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFactory.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XPathFactory.hpp 2000/03/07 16:13:44 1.3
+++ XPathFactory.hpp 2000/04/11 14:46:19 1.4
@@ -69,8 +69,6 @@
-class DOM_Element;
-class DOMString;
class XPath;
1.4 +7 -0 xml-xalan/c/src/XPath/XPathFactoryDefault.cpp
Index: XPathFactoryDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFactoryDefault.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XPathFactoryDefault.cpp 2000/03/07 16:13:44 1.3
+++ XPathFactoryDefault.cpp 2000/04/11 14:46:19 1.4
@@ -70,6 +70,9 @@
XPathFactoryDefault::XPathFactoryDefault() :
XPathFactory(),
m_xpaths()
+#if !defined(NDEBUG)
+ , m_totalInstanceCount(0)
+#endif
{
}
@@ -129,6 +132,10 @@
XPath* const theXPath = new XPath;
m_xpaths.insert(theXPath);
+
+#if !defined(NDEBUG)
+ ++m_totalInstanceCount;
+#endif
return theXPath;
}
1.6 +25 -11 xml-xalan/c/src/XPath/XPathFactoryDefault.hpp
Index: XPathFactoryDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFactoryDefault.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XPathFactoryDefault.hpp 2000/03/08 20:58:03 1.5
+++ XPathFactoryDefault.hpp 2000/04/11 14:46:19 1.6
@@ -64,11 +64,7 @@
-#if !defined(XALAN_XTREE_BUG)
#include <set>
-#else
-#error Need to implement CollectionType as a vector
-#endif
@@ -96,8 +92,28 @@
virtual XPath*
create(bool fOptimize = true);
+
-
+#if defined(XALAN_NO_NAMESPACES)
+ typedef set<const FactoryObject*> CollectionType;
+#else
+ typedef std::set<const FactoryObject*> CollectionType;
+#endif
+
+ CollectionType::size_type
+ getInstanceCount() const
+ {
+ return m_xpaths.size();
+ }
+
+#if !defined(NDEBUG)
+ unsigned long
+ getTotalInstanceCount() const
+ {
+ return m_totalInstanceCount;
+ }
+#endif
+
protected:
// Inherited from Factory...
@@ -109,13 +125,11 @@
private:
-#if defined(XALAN_NO_NAMESPACES)
- typedef set<const FactoryObject*> CollectionType;
-#else
- typedef std::set<const FactoryObject*> CollectionType;
-#endif
-
CollectionType m_xpaths;
+
+#if !defined(NDEBUG)
+ unsigned long m_totalInstanceCount;
+#endif
};
1.4 +7 -6 xml-xalan/c/src/XPath/XPathFunctionTable.cpp
Index: XPathFunctionTable.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFunctionTable.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XPathFunctionTable.cpp 2000/03/07 16:13:44 1.3
+++ XPathFunctionTable.cpp 2000/04/11 14:46:19 1.4
@@ -58,6 +58,7 @@
#include "XPathFunctionTable.hpp"
+
#include <PlatformSupport/DOMStringHelper.hpp>
@@ -108,7 +109,7 @@
void
XPathFunctionTable::InstallFunction(
- const DOMString& theFunctionName,
+ const XalanDOMString& theFunctionName,
const Function& theFunction)
{
assert(length(theFunctionName) != 0);
@@ -246,7 +247,7 @@
-XPathFunctionTableException::XPathFunctionTableException(const DOMString&
theMessage) :
+XPathFunctionTableException::XPathFunctionTableException(const
XalanDOMString& theMessage) :
XPathException(theMessage)
{
}
@@ -259,7 +260,7 @@
-XPathFunctionTableInvalidFunctionException::XPathFunctionTableInvalidFunctionException(const
DOMString& theFunctionName) :
+XPathFunctionTableInvalidFunctionException::XPathFunctionTableInvalidFunctionException(const
XalanDOMString& theFunctionName) :
XPathFunctionTableException(FormatMessage(theFunctionName))
{
}
@@ -272,11 +273,11 @@
-DOMString
-XPathFunctionTableInvalidFunctionException::FormatMessage(const DOMString&
theFunctionName)
+XalanDOMString
+XPathFunctionTableInvalidFunctionException::FormatMessage(const
XalanDOMString& theFunctionName)
{
const char* theMessage =
"Invalid function name detected: ";
- return DOMString(theMessage) + theFunctionName;
+ return XalanDOMString(theMessage) + theFunctionName;
}
1.3 +14 -12 xml-xalan/c/src/XPath/XPathFunctionTable.hpp
Index: XPathFunctionTable.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFunctionTable.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPathFunctionTable.hpp 2000/03/03 19:00:21 1.2
+++ XPathFunctionTable.hpp 2000/04/11 14:46:20 1.3
@@ -69,7 +69,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -99,7 +99,7 @@
*
* @param theMessage string error message
*/
- XPathFunctionTableException(const DOMString& theMessage);
+ XPathFunctionTableException(const XalanDOMString& theMessage);
};
@@ -116,18 +116,19 @@
*
* @param theMessage function name string
*/
- XPathFunctionTableInvalidFunctionException(const DOMString&
theFunctionName);
+ XPathFunctionTableInvalidFunctionException(const XalanDOMString&
theFunctionName);
virtual
~XPathFunctionTableInvalidFunctionException();
private:
- static DOMString
- FormatMessage(const DOMString& theFunctionName);
+ static XalanDOMString
+ FormatMessage(const XalanDOMString& theFunctionName);
};
+
/**
* Class defines a table of functions that can be called in XPath expresions.
*/
@@ -136,10 +137,11 @@
public:
#if defined(XALAN_NO_NAMESPACES)
- typedef map<DOMString, Function*> CollectionType;
+ typedef map<XalanDOMString, Function*> CollectionType;
#else
- typedef std::map<DOMString, Function*> CollectionType;
+ typedef std::map<XalanDOMString, Function*> CollectionType;
#endif
+
typedef MapValueDeleteFunctor<CollectionType> DeleteFunctorType;
XPathFunctionTable();
@@ -153,7 +155,7 @@
* @return function named
*/
Function&
- operator[](const DOMString& theFunctionName) const
+ operator[](const XalanDOMString& theFunctionName) const
{
CollectionType::const_iterator i =
m_FunctionCollection.find(theFunctionName);
@@ -176,8 +178,8 @@
*/
void
InstallFunction(
- const DOMString& theFunctionName,
- const Function& theFunction);
+ const XalanDOMString& theFunctionName,
+ const Function& theFunction);
/**
@@ -187,7 +189,7 @@
* @return true if function is in table
*/
bool
- isInstalledFunction(const DOMString& theFunctionName) const
+ isInstalledFunction(const XalanDOMString& theFunctionName) const
{
if (m_FunctionCollection.find(theFunctionName) !=
m_FunctionCollection.end())
{
@@ -200,7 +202,7 @@
}
#if defined(XALAN_NO_MEMBER_TEMPLATES)
- typedef vector<DOMString> InstalledFunctionNameVectorType;
+ typedef vector<XalanDOMString> InstalledFunctionNameVectorType;
/**
* Add a list of the names of installed functions to a vector of names.
1.2 +2 -2 xml-xalan/c/src/XPath/XPathParserException.cpp
Index: XPathParserException.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathParserException.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XPathParserException.cpp 1999/12/18 19:47:55 1.1
+++ XPathParserException.cpp 2000/04/11 14:46:20 1.2
@@ -61,8 +61,8 @@
XPathParserException::XPathParserException(
- const DOMString& message,
- const DOM_Node& styleNode) :
+ const XalanDOMString& message,
+ const XalanNode* styleNode) :
XPathException(message,
styleNode)
{
1.3 +2 -2 xml-xalan/c/src/XPath/XPathParserException.hpp
Index: XPathParserException.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathParserException.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPathParserException.hpp 2000/03/03 19:00:21 1.2
+++ XPathParserException.hpp 2000/04/11 14:46:20 1.3
@@ -83,8 +83,8 @@
*/
explicit
XPathParserException(
- const DOMString& message = DOMString(),
- const DOM_Node& styleNode = DOM_Node());
+ const XalanDOMString& message = XalanDOMString(),
+ const XalanNode* styleNode = 0);
virtual
~XPathParserException();
1.2 +2 -2 xml-xalan/c/src/XPath/XPathProcessor.cpp
Index: XPathProcessor.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessor.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XPathProcessor.cpp 1999/12/18 19:47:55 1.1
+++ XPathProcessor.cpp 2000/04/11 14:46:20 1.2
@@ -77,8 +77,8 @@
void
XPathProcessor::installFunction(
- const DOMString& theFunctionName,
- const Function& theFunction)
+ const XalanDOMString& theFunctionName,
+ const Function& theFunction)
{
XPath::installFunction(theFunctionName,
theFunction);
1.4 +9 -5 xml-xalan/c/src/XPath/XPathProcessor.hpp
Index: XPathProcessor.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessor.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XPathProcessor.hpp 2000/03/03 19:00:21 1.3
+++ XPathProcessor.hpp 2000/04/11 14:46:20 1.4
@@ -64,7 +64,11 @@
-class DOMString;
+// $$$ ToDo: This is necessary while XalanDOMString is still a typedef...
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
class Function;
class PrefixResolver;
class XObjectFactory;
@@ -96,7 +100,7 @@
virtual void
initXPath(
XPath& pathObj,
- const DOMString& expression,
+ const XalanDOMString& expression,
const PrefixResolver& resolver,
XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport) = 0;
@@ -113,7 +117,7 @@
virtual void
initMatchPattern(
XPath& pathObj,
- const DOMString& expression,
+ const XalanDOMString& expression,
const PrefixResolver& resolver,
XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport) = 0;
@@ -127,8 +131,8 @@
*/
static void
installFunction(
- const DOMString& theFunctionName,
- const Function& theFunction);
+ const XalanDOMString& theFunctionName,
+ const Function& theFunction);
};
1.5 +108 -924 xml-xalan/c/src/XPath/XPathProcessorImpl.cpp
Index: XPathProcessorImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathProcessorImpl.cpp 2000/02/17 20:29:53 1.4
+++ XPathProcessorImpl.cpp 2000/04/11 14:46:21 1.5
@@ -73,42 +73,41 @@
-static const char* const FROM_ANCESTORS_STRING = "ancestor";
-static const char* const FROM_ANCESTORS_OR_SELF_STRING =
"ancestor-or-self";
-static const char* const FROM_ATTRIBUTES_STRING = "attribute";
-static const char* const FROM_CHILDREN_STRING = "child";
-static const char* const FROM_DESCENDANTS_STRING = "descendant";
-static const char* const FROM_DESCENDANTS_OR_SELF_STRING =
"descendant-or-self";
-static const char* const FROM_FOLLOWING_STRING = "following";
-static const char* const FROM_FOLLOWING_SIBLINGS_STRING =
"following-sibling";
-static const char* const FROM_PARENT_STRING = "parent";
-static const char* const FROM_PRECEDING_STRING = "preceding";
-static const char* const FROM_PRECEDING_SIBLINGS_STRING =
"preceding-sibling";
-static const char* const FROM_SELF_STRING = "self";
-static const char* const FROM_SELF_ABBREVIATED_STRING = ".";
-static const char* const FROM_NAMESPACE_STRING = "namespace";
+static XalanDOMString
FROM_ANCESTORS_STRING(XALAN_STATIC_UCODE_STRING("ancestor"));
+static XalanDOMString
FROM_ANCESTORS_OR_SELF_STRING(XALAN_STATIC_UCODE_STRING("ancestor-or-self"));
+static XalanDOMString
FROM_ATTRIBUTES_STRING(XALAN_STATIC_UCODE_STRING("attribute"));
+static XalanDOMString
FROM_CHILDREN_STRING(XALAN_STATIC_UCODE_STRING("child"));
+static XalanDOMString
FROM_DESCENDANTS_STRING(XALAN_STATIC_UCODE_STRING("descendant"));
+static XalanDOMString
FROM_DESCENDANTS_OR_SELF_STRING(XALAN_STATIC_UCODE_STRING("descendant-or-self"));
+static XalanDOMString
FROM_FOLLOWING_STRING(XALAN_STATIC_UCODE_STRING("following"));
+static XalanDOMString
FROM_FOLLOWING_SIBLINGS_STRING(XALAN_STATIC_UCODE_STRING("following-sibling"));
+static XalanDOMString
FROM_PARENT_STRING(XALAN_STATIC_UCODE_STRING("parent"));
+static XalanDOMString
FROM_PRECEDING_STRING(XALAN_STATIC_UCODE_STRING("preceding"));
+static XalanDOMString
FROM_PRECEDING_SIBLINGS_STRING(XALAN_STATIC_UCODE_STRING("preceding-sibling"));
+static XalanDOMString
FROM_SELF_STRING(XALAN_STATIC_UCODE_STRING("self"));
+static XalanDOMString
FROM_SELF_ABBREVIATED_STRING(XALAN_STATIC_UCODE_STRING("."));
+static XalanDOMString
FROM_NAMESPACE_STRING(XALAN_STATIC_UCODE_STRING("namespace"));
// This shouldn't really be here, since it duplicates a string that is part
// of the information that is maintained by the class XPathFunctionTable,
// but this is a reasonable optimization.
-static const char* const FUNC_ID_STRING = "id";
+static XalanDOMString FUNC_ID_STRING(XALAN_STATIC_UCODE_STRING("id"));
// These shouldn't really be here, since they are not part of the XPath
standard,
// but rather a part ofthe XSLT standard.
-static const char* const FUNC_KEY_STRING = "key";
-static const char* const FUNC_DOC_STRING = "doc";
-static const char* const FUNC_DOCUMENT_STRING = "document";
+static XalanDOMString
FUNC_KEY_STRING(XALAN_STATIC_UCODE_STRING("key"));
+static XalanDOMString
FUNC_DOC_STRING(XALAN_STATIC_UCODE_STRING("doc"));
+static XalanDOMString
FUNC_DOCUMENT_STRING(XALAN_STATIC_UCODE_STRING("document"));
+
+static XalanDOMString
NODETYPE_COMMENT_STRING(XALAN_STATIC_UCODE_STRING("comment"));
+static XalanDOMString
NODETYPE_TEXT_STRING(XALAN_STATIC_UCODE_STRING("text"));
+static XalanDOMString
NODETYPE_PI_STRING(XALAN_STATIC_UCODE_STRING("processing-instruction"));
+static XalanDOMString
NODETYPE_NODE_STRING(XALAN_STATIC_UCODE_STRING("node"));
+static XalanDOMString
NODETYPE_ANYELEMENT_STRING(XALAN_STATIC_UCODE_STRING("*"));
-static const char* const NODETYPE_COMMENT_STRING = "comment";
-static const char* const NODETYPE_TEXT_STRING = "text";
-static const char* const NODETYPE_PI_STRING = "processing-instruction";
-static const char* const NODETYPE_NODE_STRING = "node";
-static const char* const NODETYPE_ANYELEMENT_STRING = "*";
-
-
XPathProcessorImpl::KeywordsMapType
XPathProcessorImpl::s_keywords;
XPathProcessorImpl::FunctionNameMapType
XPathProcessorImpl::s_functions;
XPathProcessorImpl::AxisNamesMapType
XPathProcessorImpl::s_axisNames;
@@ -140,7 +139,7 @@
void
XPathProcessorImpl::initXPath(
XPath& pathObj,
- const DOMString& expression,
+ const XalanDOMString& expression,
const PrefixResolver& prefixResolver,
XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport)
@@ -171,7 +170,7 @@
void
XPathProcessorImpl::initMatchPattern(
XPath& pathObj,
- const DOMString& expression,
+ const XalanDOMString& expression,
const PrefixResolver& prefixResolver,
XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport)
@@ -207,8 +206,8 @@
void
XPathProcessorImpl::tokenize(
- const DOMString& pat,
- std::vector<DOMString>* targetStrings)
+ const XalanDOMString& pat,
+ std::vector<XalanDOMString>* targetStrings)
{
m_expression->setCurrentPattern(pat);
@@ -228,7 +227,7 @@
// char[] chars = pat.toCharArray();
for(int i = 0; i < nChars; i++)
{
- XMLCh c = charAt(pat, i);
+ XalanDOMChar c = charAt(pat, i);
switch(c)
{
@@ -513,7 +512,7 @@
void
-XPathProcessorImpl::recordTokenString(std::vector<DOMString>&
targetStrings)
+XPathProcessorImpl::recordTokenString(std::vector<XalanDOMString>&
targetStrings)
{
assert(m_expression != 0);
@@ -580,7 +579,7 @@
void
-XPathProcessorImpl::addToTokenQueue(const DOMString& s) const
+XPathProcessorImpl::addToTokenQueue(const XalanDOMString& s) const
{
assert(m_xpath != 0);
assert(m_expression != 0);
@@ -593,25 +592,25 @@
int
XPathProcessorImpl::mapNSTokens(
- const DOMString& pat,
- int startSubstring,
- int posOfNSSep,
- int posOfScan) const
+ const XalanDOMString& pat,
+ int startSubstring,
+ int posOfNSSep,
+ int posOfScan) const
{
assert(m_prefixResolver != 0);
- const DOMString prefix = substring(pat, startSubstring,
posOfNSSep);
+ const XalanDOMString prefix = substring(pat, startSubstring,
posOfNSSep);
- const DOMString uName =
+ const XalanDOMString uName =
m_prefixResolver->getNamespaceForPrefix(prefix);
if(length(uName) > 0)
{
addToTokenQueue(uName);
- addToTokenQueue(":");
+ addToTokenQueue(XALAN_STATIC_UCODE_STRING(":"));
- const DOMString s = substring(pat, posOfNSSep + 1,
posOfScan);
+ const XalanDOMString s = substring(pat, posOfNSSep + 1,
posOfScan);
if(length(s) > 0)
{
@@ -620,12 +619,12 @@
}
else
{
- // error(DOMString("Could not locate namespace for prefix: ") +
prefix);
+ // error(XalanDOMString("Could not locate namespace for prefix:
") + prefix);
addToTokenQueue(prefix);
- addToTokenQueue(":");
+ addToTokenQueue(XALAN_STATIC_UCODE_STRING(":"));
- const DOMString s = substring(pat, posOfNSSep + 1,
posOfScan);
+ const XalanDOMString s = substring(pat, posOfNSSep + 1,
posOfScan);
if(s.length() > 0)
{
@@ -651,7 +650,7 @@
bool
-XPathProcessorImpl::tokenIs(const char* s) const
+XPathProcessorImpl::tokenIs(const XalanDOMString& s) const
{
return equals(m_token, s);
}
@@ -659,9 +658,17 @@
bool
+XPathProcessorImpl::tokenIs(const XalanDOMChar* s) const
+{
+ return equals(m_token, s);
+}
+
+
+
+bool
XPathProcessorImpl::tokenIs(char c) const
{
- return m_tokenChar == static_cast<XMLCh>(c) ? true : false;
+ return m_tokenChar == c ? true : false;
}
@@ -671,7 +678,7 @@
char c,
int n) const
{
- const DOMString tok =
+ const XalanDOMString tok =
getTokenRelative(n - 1);
if (length(tok) == 1 &&
@@ -689,10 +696,12 @@
bool
XPathProcessorImpl::lookahead(
- const char* s,
- int n) const
+ const XalanDOMChar* s,
+ int n) const
{
- const DOMString tok =
+ assert(s != 0);
+
+ const XalanDOMString tok =
getTokenRelative(n - 1);
return equals(tok, s);
@@ -701,11 +710,24 @@
bool
+XPathProcessorImpl::lookahead(
+ const XalanDOMString& s,
+ int n) const
+{
+ const XalanDOMString tok =
+ getTokenRelative(n - 1);
+
+ return equals(tok, s);
+}
+
+
+
+bool
XPathProcessorImpl::lookbehind(
char c,
int n) const
{
- const DOMString tok =
+ const XalanDOMString tok =
getTokenRelative(-(n + 1));
if (length(tok) == 1 &&
@@ -724,10 +746,10 @@
bool
XPathProcessorImpl::lookbehindHasToken(int n) const
{
- const DOMString tok =
+ const XalanDOMString tok =
getTokenRelative(-(n + 1));
- const XMLCh c0 = length(tok) == 0 ? '|' : charAt(tok, 0);
+ const XalanDOMChar c0 = length(tok) == 0 ? '|' :
charAt(tok, 0);
return c0 == '|' ? false : true;
}
@@ -742,7 +764,7 @@
const XObject* const theNextToken =
m_expression->getNextToken();
- m_token = theNextToken == 0 ? "" : theNextToken->str();
+ m_token = theNextToken == 0 ? XalanDOMString() : theNextToken->str();
if(length(m_token) > 0)
{
@@ -764,7 +786,7 @@
const XObject* const thePreviousToken =
m_expression->getPreviousToken();
- m_token = thePreviousToken == 0 ? "" : thePreviousToken->str();
+ m_token = thePreviousToken == 0 ? XalanDOMString() :
thePreviousToken->str();
if(length(m_token) > 0)
{
@@ -778,7 +800,7 @@
-DOMString
+XalanDOMString
XPathProcessorImpl::getTokenRelative(int theOffset) const
{
assert(m_expression != 0);
@@ -786,7 +808,7 @@
const XObject* const theToken =
m_expression->getRelativeToken(theOffset);
- return theToken == 0 ? DOMString() : theToken->str();
+ return theToken == 0 ? XalanDOMString() : theToken->str();
}
@@ -810,9 +832,9 @@
}
else
{
- error(DOMString("Expected ") +
- DOMString(expected) +
- DOMString(", but found: ") +
+ error(XalanDOMString("Expected ") +
+ XalanDOMString(expected) +
+ XalanDOMString(", but found: ") +
m_token);
}
}
@@ -828,7 +850,7 @@
}
else
{
- DOMString theMsg("Expected ");
+ XalanDOMString theMsg("Expected ");
theMsg += expected;
theMsg += ", but found: ";
@@ -842,8 +864,8 @@
void
XPathProcessorImpl::warn(
- const DOMString& msg,
- const DOM_Node& sourceNode) const
+ const XalanDOMString& msg,
+ XalanNode* sourceNode)
const
{
assert(m_envSupport != 0);
@@ -866,10 +888,10 @@
void
XPathProcessorImpl::error(
- const DOMString& msg,
- const DOM_Node& sourceNode) const
+ const XalanDOMString& msg,
+ XalanNode* sourceNode)
const
{
- DOMString emsg;
+ XalanDOMString emsg;
if (m_expression == 0)
{
@@ -877,14 +899,14 @@
}
else
{
- const DOMString& theCurrentPattern =
+ const XalanDOMString& theCurrentPattern =
m_expression->getCurrentPattern();
DOMStringPrintWriter thePrintWriter;
if (length(theCurrentPattern) != 0)
{
- thePrintWriter.print("pattern = '");
+ thePrintWriter.print(XALAN_STATIC_UCODE_STRING("pattern
= '"));
thePrintWriter.println(theCurrentPattern);
}
@@ -915,7 +937,7 @@
int
-XPathProcessorImpl::getKeywordToken(const DOMString& key) const
+XPathProcessorImpl::getKeywordToken(const XalanDOMString& key) const
{
KeywordsMapType::const_iterator i =
s_keywords.find(key);
@@ -933,7 +955,7 @@
int
-XPathProcessorImpl::getFunctionToken(const DOMString& key) const
+XPathProcessorImpl::getFunctionToken(const XalanDOMString& key) const
{
FunctionNameMapType::const_iterator i = s_functions.find(key);
@@ -964,7 +986,7 @@
AndExpr();
- if(tokenIs("or") == true)
+ if(tokenIs(XALAN_STATIC_UCODE_STRING("or")) == true)
{
nextToken();
@@ -987,7 +1009,7 @@
EqualityExpr();
- if(tokenIs("and") == true)
+ if(tokenIs(XALAN_STATIC_UCODE_STRING("and")) == true)
{
nextToken();
@@ -1236,15 +1258,15 @@
{
theOpCode = XPathExpression::eOP_MULT;
}
- else if(tokenIs("div") == true)
+ else if(tokenIs(XALAN_STATIC_UCODE_STRING("div")) == true)
{
theOpCode = XPathExpression::eOP_DIV;
}
- else if(tokenIs("mod") == true)
+ else if(tokenIs(XALAN_STATIC_UCODE_STRING("mod")) == true)
{
theOpCode = XPathExpression::eOP_MOD;
}
- else if(tokenIs("quo") == true)
+ else if(tokenIs(XALAN_STATIC_UCODE_STRING("quo")) == true)
{
theOpCode = XPathExpression::eOP_QUO;
}
@@ -1596,9 +1618,9 @@
{
if (isValidFunction(m_token) == false)
{
- warn(DOMString("Could not find function: ") +
+ warn(XalanDOMString("Could not find function: ") +
m_token +
- DOMString("()"));
+ XalanDOMString("()"));
}
// $$$ ToDo: I believe that this is XSLT functionality. We
@@ -1732,7 +1754,7 @@
{
const int opPos = m_expression->opCodeMapLength();
- if(tokenIs(".") == true)
+ if(tokenIs('.') == true)
{
nextToken();
@@ -1751,7 +1773,7 @@
m_expression->appendOpCode(XPathExpression::eNODETYPE_NODE);
}
- else if(tokenIs("..") == true)
+ else if(tokenIs(XALAN_STATIC_UCODE_STRING("..")) == true)
{
nextToken();
@@ -1790,7 +1812,7 @@
const int opPos = m_expression->opCodeMapLength();
// The next blocks guarantee that a FROM_XXX will be added.
- if(lookahead("::", 1) == true)
+ if(lookahead(XALAN_STATIC_UCODE_STRING("::"), 1) == true)
{
AxisName();
@@ -1855,7 +1877,7 @@
if (i == s_axisNames.end())
{
- error(DOMString("illegal axis name: ") +
+ error(XalanDOMString("illegal axis name: ") +
m_token);
}
else
@@ -1879,7 +1901,7 @@
if (i == s_nodeTypes.end())
{
- error(DOMString("Unknown nodetype: ") +
+ error(XalanDOMString("Unknown nodetype: ") +
m_token);
}
else
@@ -2020,8 +2042,8 @@
assert(last > 0);
- const XMLCh c0 = m_tokenChar;
- const XMLCh cX = charAt(m_token, last);
+ const XalanDOMChar c0 = m_tokenChar;
+ const XalanDOMChar cX = charAt(m_token, last);
if((c0 == '\"' && cX == '\"') ||
(c0 == '\'' && cX == '\''))
@@ -2035,9 +2057,9 @@
}
else
{
- error(DOMString("Pattern literal (") +
+ error(XalanDOMString("Pattern literal (") +
m_token +
- DOMString(") needs to be quoted!"));
+ XalanDOMString(") needs to be quoted!"));
}
}
@@ -2239,7 +2261,7 @@
bool
-XPathProcessorImpl::isValidFunction(const DOMString& key) const
+XPathProcessorImpl::isValidFunction(const XalanDOMString& key) const
{
bool fResult = true;
@@ -2253,844 +2275,6 @@
return fResult;
}
-
-
-
-#if 0
- // ============= GRAMMAR FUNCTIONS =================
- private void ____DIAGNOSTIC_FUNCTIONS____(){}
-
- public static void diagnoseXPathString( String str )
- {
- XPathSupport callbacks = new XPathSupportDefault();
- XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
- XPath xpath = new XPath(callbacks);
- processor.initXPath(xpath, str, null);
- processor.diagnoseXPath(xpath, 0, 0);
- }
-
- static int diagnoseXPathBinaryOperation(String op, XPath xpath, int opPos,
int indent)
- {
- System.out.println(op+" {");
- opPos+=2;
-
- opPos = diagnoseXPath(xpath, opPos, indent+1);
-
- opPos = diagnoseXPath(xpath, opPos, indent+1);
-
- indent(indent);
- System.out.println("}");
- return opPos;
- }
-
- static int diagnoseXPathUnaryOperation(String op, XPath xpath, int opPos,
int indent)
- {
- System.out.println(op+" {");
- opPos+=2;
- opPos = diagnoseXPath(xpath, opPos, indent+1);
- indent(indent);
- System.out.println("}");
- return opPos;
- }
-
- static int diagnoseXPathMultiOperation(String op, int multiOp, XPath
xpath, int opPos, int indent)
- {
- System.out.println(op+" {");
- opPos+=2;
- while(xpath.m_opMap[opPos] == multiOp)
- {
- indent(indent+1);
- System.out.println("{");
- opPos = diagnoseXPath(xpath, opPos, indent+2);
- indent(indent+1);
- System.out.println("}");
- }
- indent(indent);
- System.out.println("}");
- return opPos;
- }
-
- static int diagnoseToken(XPath xpath, int opPos)
- {
- System.out.print("{");
- System.out.print(xpath.m_tokenQueue[xpath.m_opMap[opPos]]);
- System.out.print("}");
- return opPos+1;
- }
-
- static int diagnoseXPathSimpleOperation(String op, XPath xpath, int opPos,
int indent)
- {
- opPos+=2;
- System.out.print(op);
- opPos = diagnoseToken(xpath, opPos);
- System.out.println("");
- return opPos;
- }
-
- static int diagnoseXPathLocationStep(String op, XPath xpath, int opPos,
int indent)
- {
- // int opLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH];
- int stepLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH+1];
- opPos+=3;
- System.out.print(op);
- if(stepLen > 3)
- {
- opPos = diagnoseXPath(xpath, opPos, 1);
- }
- System.out.println("");
- return opPos;
- }
-
- static int diagnoseXPath(XPath xpath, int opPos, int indent)
- {
- indent(indent);
- switch(xpath.m_opMap[opPos])
- {
- case xpath.OP_XPATH:
- opPos = diagnoseXPathUnaryOperation("OP_XPATH", xpath, opPos, indent);
- break;
- case xpath.EMPTY:
- System.out.println("{EMPTY}");
- opPos++;
- break;
- case xpath.OP_OR:
- opPos = diagnoseXPathBinaryOperation("OP_OR", xpath, opPos, indent);
- break;
- case xpath.OP_AND:
- opPos = diagnoseXPathBinaryOperation("OP_AND", xpath, opPos, indent);
- break;
- case xpath.OP_NOTEQUALS:
- opPos = diagnoseXPathBinaryOperation("OP_NOTEQUALS", xpath, opPos,
indent);
- break;
- case xpath.OP_EQUALS:
- opPos = diagnoseXPathBinaryOperation("OP_EQUALS", xpath, opPos,
indent);
- break;
- case xpath.OP_LTE:
- opPos = diagnoseXPathBinaryOperation("OP_LTE", xpath, opPos, indent);
- break;
- case xpath.OP_LT:
- opPos = diagnoseXPathBinaryOperation("OP_LT", xpath, opPos, indent);
- break;
- case xpath.OP_GTE:
- opPos = diagnoseXPathBinaryOperation("OP_GTE", xpath, opPos, indent);
- break;
- case xpath.OP_GT:
- opPos = diagnoseXPathBinaryOperation("OP_GT", xpath, opPos, indent);
- break;
- case xpath.OP_PLUS:
- opPos = diagnoseXPathBinaryOperation("OP_PLUS", xpath, opPos, indent);
- break;
- case xpath.OP_MINUS:
- opPos = diagnoseXPathBinaryOperation("OP_MINUS", xpath, opPos,
indent);
- break;
- case xpath.OP_MULT:
- opPos = diagnoseXPathBinaryOperation("OP_MULT", xpath, opPos, indent);
- break;
- case xpath.OP_DIV:
- opPos = diagnoseXPathBinaryOperation("OP_DIV", xpath, opPos, indent);
- break;
- case xpath.OP_MOD:
- opPos = diagnoseXPathBinaryOperation("OP_MOD", xpath, opPos, indent);
- break;
- case xpath.OP_QUO:
- opPos = diagnoseXPathBinaryOperation("OP_QUO", xpath, opPos, indent);
- break;
- case xpath.OP_NEG:
- opPos = diagnoseXPathUnaryOperation("OP_NEG", xpath, opPos, indent);
- break;
- case xpath.OP_STRING:
- opPos = diagnoseXPathUnaryOperation("OP_STRING", xpath, opPos,
indent);
- break;
- case xpath.OP_BOOL:
- opPos = diagnoseXPathUnaryOperation("OP_BOOL", xpath, opPos, indent);
- break;
- case xpath.OP_NUMBER:
- opPos = diagnoseXPathUnaryOperation("OP_NUMBER", xpath, opPos,
indent);
- break;
- case xpath.OP_UNION:
- opPos = diagnoseXPathMultiOperation("OP_UNION",
xpath.OP_LOCATIONPATH, xpath, opPos, indent);
- break;
- case xpath.OP_LITERAL:
- opPos = diagnoseXPathSimpleOperation("OP_LITERAL", xpath, opPos,
indent);
- break;
- case xpath.OP_VARIABLE:
- opPos = diagnoseXPathSimpleOperation("OP_VARIABLE", xpath, opPos,
indent);
- break;
- case xpath.OP_GROUP:
- opPos = diagnoseXPathUnaryOperation("OP_GROUP", xpath, opPos, indent);
- break;
- case xpath.OP_NUMBERLIT:
- opPos = diagnoseXPathSimpleOperation("OP_NUMBERLIT", xpath, opPos,
indent);
- break;
- case xpath.OP_ARGUMENT:
- opPos = diagnoseXPathUnaryOperation("OP_ARGUMENT", xpath, opPos,
indent);
- break;
- case xpath.OP_EXTFUNCTION:
- {
- System.out.println("OP_EXTFUNCTION {");
- int endExtFunc = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- indent(indent+1);
- opPos = diagnoseToken(xpath, opPos);
- System.out.print(":");
- opPos = diagnoseToken(xpath, opPos);
- System.out.println("");
- while(opPos < endExtFunc)
- {
- indent(indent+1);
- System.out.println("{");
- opPos = diagnoseXPath(xpath, opPos, indent+2);
- indent(indent+1);
- System.out.println("}");
- }
- indent(indent);
- System.out.println("}");
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- opPos++;
- }
- break;
- case xpath.OP_FUNCTION:
- {
- System.out.println("OP_FUNCTION {");
- int endFunc = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- indent(indent+1);
- int funcID = xpath.m_opMap[opPos];
- switch(funcID)
- {
- case xpath.FUNC_LAST: System.out.print("FUNC_LAST"); break;
- case xpath.FUNC_POSITION: System.out.print("FUNC_POSITION");
break;
- case xpath.FUNC_COUNT: System.out.print("FUNC_COUNT"); break;
- case xpath.FUNC_ID: System.out.print("FUNC_ID"); break;
- case xpath.FUNC_KEY: System.out.print("FUNC_KEY"); break;
- case xpath.FUNC_DOC: System.out.print("FUNC_DOC"); break;
- case xpath.FUNC_LOCAL_PART:
System.out.print("FUNC_LOCAL_PART"); break;
- case xpath.FUNC_NAMESPACE: System.out.print("FUNC_NAMESPACE");
break;
- case xpath.FUNC_QNAME: System.out.print("FUNC_QNAME"); break;
- case xpath.FUNC_GENERATE_ID:
System.out.print("FUNC_GENERATE_ID"); break;
- case xpath.FUNC_NOT: System.out.print("FUNC_NOT"); break;
- case xpath.FUNC_TRUE: System.out.print("FUNC_TRUE"); break;
- case xpath.FUNC_FALSE: System.out.print("FUNC_FALSE"); break;
- case xpath.FUNC_BOOLEAN: System.out.print("FUNC_BOOLEAN");
break;
- case xpath.FUNC_LANG: System.out.print("FUNC_LANG"); break;
- case xpath.FUNC_NUMBER: System.out.print("FUNC_NUMBER"); break;
- case xpath.FUNC_FLOOR: System.out.print("FUNC_FLOOR"); break;
- case xpath.FUNC_CEILING: System.out.print("FUNC_CEILING");
break;
- case xpath.FUNC_ROUND: System.out.print("FUNC_ROUND"); break;
- case xpath.FUNC_SUM: System.out.print("FUNC_SUM"); break;
- case xpath.FUNC_STRING: System.out.print("FUNC_STRING"); break;
- case xpath.FUNC_STARTS_WITH:
System.out.print("FUNC_STARTS_WITH"); break;
- case xpath.FUNC_CONTAINS: System.out.print("FUNC_CONTAINS");
break;
- case xpath.FUNC_SUBSTRING_BEFORE:
System.out.print("FUNC_SUBSTRING_BEFORE"); break;
- case xpath.FUNC_SUBSTRING_AFTER:
System.out.print("FUNC_SUBSTRING_AFTER"); break;
- case xpath.FUNC_NORMALIZE: System.out.print("FUNC_NORMALIZE");
break;
- case xpath.FUNC_TRANSLATE: System.out.print("FUNC_TRANSLATE");
break;
- case xpath.FUNC_CONCAT: System.out.print("FUNC_CONCAT"); break;
- case xpath.FUNC_FORMAT_NUMBER:
System.out.print("FUNC_FORMAT_NUMBER"); break;
- case xpath.FUNC_SYSTEM_PROPERTY:
System.out.print("FUNC_SYSTEM_PROPERTY"); break;
- case xpath.FUNC_EXT_FUNCTION_AVAILABLE:
System.out.print("FUNC_EXT_FUNCTION_AVAILABLE"); break;
- case xpath.FUNC_EXT_ELEM_AVAILABLE:
System.out.print("FUNC_EXT_ELEM_AVAILABLE"); break;
- case xpath.FUNC_SUBSTRING: System.out.print("FUNC_SUBSTRING");
break;
- case xpath.FUNC_STRING_LENGTH:
System.out.print("FUNC_STRING_LENGTH"); break;
- case xpath.FUNC_DOCLOCATION:
System.out.print("FUNC_DOCLOCATION"); break;
- }
- opPos++;
- System.out.println("");
- while(opPos < endFunc)
- {
- indent(indent+1);
- System.out.println("{");
- opPos = diagnoseXPath(xpath, opPos, indent+2);
- indent(indent+1);
- System.out.println("}");
- }
- indent(indent);
- System.out.println("}");
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- opPos++;
- }
- break;
- case xpath.OP_LOCATIONPATH:
- System.out.println("OP_LOCATIONPATH"+" {");
- int endPath = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- while(opPos < endPath)
- {
- opPos = diagnoseXPath(xpath, opPos, indent+1);
- }
- indent(indent);
- System.out.println("}");
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- opPos++;
- break;
- case xpath.OP_PREDICATE:
- opPos = diagnoseXPathUnaryOperation("OP_PREDICATE", xpath, opPos,
indent);
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- opPos++;
- break;
- case xpath.FROM_ANCESTORS:
- opPos = diagnoseXPathLocationStep("FROM_ANCESTORS", xpath, opPos, 1);
- break;
- case xpath.FROM_ANCESTORS_OR_SELF:
- opPos = diagnoseXPathLocationStep("FROM_ANCESTORS_OR_SELF", xpath,
opPos, 1);
- break;
- case xpath.FROM_ATTRIBUTES:
- opPos = diagnoseXPathLocationStep("FROM_ATTRIBUTES", xpath, opPos, 1);
- break;
- case xpath.FROM_CHILDREN:
- opPos = diagnoseXPathLocationStep("FROM_CHILDREN", xpath, opPos, 1);
- break;
- case xpath.FROM_DESCENDANTS:
- opPos = diagnoseXPathLocationStep("FROM_DESCENDANTS", xpath, opPos,
1);
- break;
- case xpath.FROM_DESCENDANTS_OR_SELF:
- opPos = diagnoseXPathLocationStep("FROM_DESCENDANTS_OR_SELF", xpath,
opPos, 1);
- break;
- case xpath.FROM_FOLLOWING:
- opPos = diagnoseXPathLocationStep("FROM_FOLLOWING", xpath, opPos,
indent);
- break;
- case xpath.FROM_FOLLOWING_SIBLINGS:
- opPos = diagnoseXPathLocationStep("FROM_FOLLOWING_SIBLINGS", xpath,
opPos, indent);
- break;
- case xpath.FROM_PARENT:
- opPos = diagnoseXPathLocationStep("FROM_PARENT", xpath, opPos,
indent);
- break;
- case xpath.FROM_PRECEDING:
- opPos = diagnoseXPathLocationStep("FROM_PRECEDING", xpath, opPos,
indent);
- break;
- case xpath.FROM_PRECEDING_SIBLINGS:
- opPos = diagnoseXPathLocationStep("FROM_PRECEDING_SIBLINGS", xpath,
opPos, indent);
- break;
- case xpath.FROM_SELF:
- opPos = diagnoseXPathLocationStep("FROM_SELF", xpath, opPos, indent);
- break;
- case xpath.FROM_NAMESPACE:
- opPos = diagnoseXPathLocationStep("FROM_NAMESPACE", xpath, opPos,
indent);
- break;
- // case xpath.FROM_ATTRIBUTE:
- // opPos = diagnoseXPathLocationStep("FROM_ATTRIBUTE", xpath,
opPos, indent);
- // break;
- // case xpath.FROM_DOC:
- // opPos = diagnoseXPathLocationStep("FROM_DOC", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_DOCREF:
- // opPos = diagnoseXPathLocationStep("FROM_DOCREF", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_ID:
- // opPos = diagnoseXPathLocationStep("FROM_ID", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_IDREF:
- // opPos = diagnoseXPathLocationStep("FROM_IDREF", xpath, opPos,
indent);
- // break;
- case xpath.FROM_ROOT:
- opPos = diagnoseXPathLocationStep("FROM_ROOT", xpath, opPos, indent);
- break;
- case xpath.NODETYPE_COMMENT:
- System.out.println("{NODETYPE_COMMENT}");
- opPos++;
- break;
- case xpath.NODETYPE_TEXT:
- System.out.println("{NODETYPE_TEXT}");
- opPos++;
- break;
- case xpath.NODETYPE_PI:
- int piLen = xpath.m_opMap[opPos-1];
- System.out.println("{NODETYPE_PI ");
- opPos++;
- if(piLen > 3)
- {
- opPos = diagnoseToken(xpath, opPos);
- }
- break;
- case xpath.NODETYPE_NODE:
- System.out.println("{NODETYPE_NODE}");
- opPos++;
- break;
- case xpath.NODETYPE_ROOT:
- System.out.println("{NODETYPE_ROOT}");
- opPos++;
- break;
- case xpath.NODETYPE_ANYELEMENT:
- System.out.println("{NODETYPE_ANYELEMENT}");
- opPos++;
- break;
- case xpath.NODENAME:
- System.out.print("{NODENAME ");
- opPos++;
- if(xpath.m_opMap[opPos] < 0)
- {
- System.out.print("{EMPTY}");
- opPos++;
- }
- else
- {
- opPos = diagnoseToken(xpath, opPos);
- }
- System.out.print(":");
- opPos = diagnoseToken(xpath, opPos);
- break;
- default:
- System.out.println("ERROR! Unknown op code: "+xpath.m_opMap[opPos]);
- }
- return opPos;
- }
-
- static void indent(int amount)
- {
- int n = amount * 3;
- for(int i = 0; i < n; i ++)
- {
- System.out.print(" ");
- }
- }
-
- private static String m_opLabel = "[";
- private static String m_lenLabel = "[";
- private static String m_arglenLabel = "[";
- private static String m_noLabel = "[";
- private static String m_nTestLabel = "[";
- private static String m_open = "[";
- private static String m_close = "]";
-
- public static void diagnoseXPathString2( String str )
- {
- XPathSupport callbacks = new XPathSupportDefault();
- XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
- XPath xpath = new XPath(callbacks);
- processor.initXPath(xpath, str, null);
- processor.diagnoseXPath2(xpath, 0, 0);
- }
-
- public static void diagnoseXPathString3( String str )
- {
- XPathSupport callbacks = new XPathSupportDefault();
- XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
- XPath xpath = new XPath(callbacks);
- processor.initXPath(xpath, str, null);
- int len = xpath.m_opMap[xpath.MAPINDEX_LENGTH];
- for(int i = 0; i < len; i++)
- {
- System.out.println("["+xpath.m_opMap[i]+"]");
- }
- }
-
- private static void diagnoseNodeTest2(int opPos, String op)
- {
- System.out.print(m_nTestLabel+op+m_close);
- }
-
- private static void diagnoseOpNoLable2(int opPos, String op)
- {
- System.out.println(m_noLabel+op+m_close);
- }
-
- private static void diagnoseOpOnly2(int opPos, String op)
- {
- System.out.println(m_opLabel+op+m_close);
- }
-
- private static void diagnoseOp2(String op, XPath xpath, int opPos)
- {
- System.out.print(m_opLabel+op+m_close);
- int opLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH];
- System.out.println(m_open+opLen+m_close);
- }
-
- private static void diagnoseOp2SameLine(String op, XPath xpath, int opPos)
- {
- System.out.print(m_opLabel+op+m_close);
- int opLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH];
- System.out.print(m_open+opLen+m_close);
- }
-
- static int diagnoseXPathBinaryOperation2(String op, XPath xpath, int
opPos, int indent)
- {
- diagnoseOp2(op, xpath, opPos);
- opPos+=2;
-
- opPos = diagnoseXPath2(xpath, opPos, indent+1);
-
- opPos = diagnoseXPath2(xpath, opPos, indent+1);
-
- return opPos;
- }
-
- static int diagnoseXPathUnaryOperation2(String op, XPath xpath, int opPos,
int indent)
- {
- diagnoseOp2(op, xpath, opPos);
- opPos+=2;
- opPos = diagnoseXPath2(xpath, opPos, indent+1);
- return opPos;
- }
-
- static int diagnoseXPathMultiOperation2(String op, int multiOp, XPath
xpath, int opPos, int indent)
- {
- diagnoseOp2(op, xpath, opPos);
- opPos+=2;
- while(xpath.m_opMap[opPos] == multiOp)
- {
- opPos = diagnoseXPath2(xpath, opPos, indent+2);
- }
- return opPos;
- }
-
- static int diagnoseToken2(XPath xpath, int opPos)
- {
- int tokenPos = xpath.m_opMap[opPos];
- String token = (tokenPos >= 0) ?
xpath.m_tokenQueue[tokenPos].toString() :
-
(tokenPos == xpath.ELEMWILDCARD) ?
- "*" :
(tokenPos == xpath.EMPTY) ?
-
"EMPTY" : "UNKNOWN";
- System.out.println(m_noLabel+token+m_close);
- return opPos+1;
- }
-
- static int diagnoseToken2SameLine(XPath xpath, int opPos)
- {
-
System.out.print(m_noLabel+xpath.m_tokenQueue[xpath.m_opMap[opPos]]+m_close);
- return opPos+1;
- }
-
- static int diagnoseXPathSimpleOperation2(String op, XPath xpath, int
opPos, int indent)
- {
- diagnoseOp2SameLine(op, xpath, opPos);
- opPos+=2;
- opPos = diagnoseToken2(xpath, opPos);
- return opPos;
- }
-
- static int diagnoseXPathLocationStep2(String op, XPath xpath, int opPos,
int indent)
- {
- int opLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH];
- int stepLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH+1];
- System.out.print(m_opLabel+op+m_close);
- System.out.print(m_open+opLen+m_close);
- System.out.print(m_open+stepLen+m_close);
- opPos+=3;
- if(stepLen > 3)
- {
- opPos = diagnoseXPath2(xpath, opPos, 0);
- }
- return opPos;
- }
-
- static int diagnoseXPath2(XPath xpath, int opPos, int indent)
- {
- indent(indent);
- switch(xpath.m_opMap[opPos])
- {
- case xpath.OP_XPATH:
- opPos = diagnoseXPathUnaryOperation2("OP_XPATH", xpath, opPos,
indent);
- break;
- case xpath.EMPTY:
- diagnoseOpOnly2(opPos, "EMPTY");
- opPos++;
- break;
- case xpath.OP_OR:
- opPos = diagnoseXPathBinaryOperation2("OP_OR", xpath, opPos, indent);
- break;
- case xpath.OP_AND:
- opPos = diagnoseXPathBinaryOperation2("OP_AND", xpath, opPos, indent);
- break;
- case xpath.OP_NOTEQUALS:
- opPos = diagnoseXPathBinaryOperation2("OP_NOTEQUALS", xpath, opPos,
indent);
- break;
- case xpath.OP_EQUALS:
- opPos = diagnoseXPathBinaryOperation2("OP_EQUALS", xpath, opPos,
indent);
- break;
- case xpath.OP_LTE:
- opPos = diagnoseXPathBinaryOperation2("OP_LTE", xpath, opPos, indent);
- break;
- case xpath.OP_LT:
- opPos = diagnoseXPathBinaryOperation2("OP_LT", xpath, opPos, indent);
- break;
- case xpath.OP_GTE:
- opPos = diagnoseXPathBinaryOperation2("OP_GTE", xpath, opPos, indent);
- break;
- case xpath.OP_GT:
- opPos = diagnoseXPathBinaryOperation2("OP_GT", xpath, opPos, indent);
- break;
- case xpath.OP_PLUS:
- opPos = diagnoseXPathBinaryOperation2("OP_PLUS", xpath, opPos,
indent);
- break;
- case xpath.OP_MINUS:
- opPos = diagnoseXPathBinaryOperation2("OP_MINUS", xpath, opPos,
indent);
- break;
- case xpath.OP_MULT:
- opPos = diagnoseXPathBinaryOperation2("OP_MULT", xpath, opPos,
indent);
- break;
- case xpath.OP_DIV:
- opPos = diagnoseXPathBinaryOperation2("OP_DIV", xpath, opPos, indent);
- break;
- case xpath.OP_MOD:
- opPos = diagnoseXPathBinaryOperation2("OP_MOD", xpath, opPos, indent);
- break;
- case xpath.OP_QUO:
- opPos = diagnoseXPathBinaryOperation2("OP_QUO", xpath, opPos, indent);
- break;
- case xpath.OP_NEG:
- opPos = diagnoseXPathUnaryOperation2("OP_NEG", xpath, opPos, indent);
- break;
- case xpath.OP_STRING:
- opPos = diagnoseXPathUnaryOperation2("OP_STRING", xpath, opPos,
indent);
- break;
- case xpath.OP_BOOL:
- opPos = diagnoseXPathUnaryOperation2("OP_BOOL", xpath, opPos, indent);
- break;
- case xpath.OP_NUMBER:
- opPos = diagnoseXPathUnaryOperation2("OP_NUMBER", xpath, opPos,
indent);
- break;
- case xpath.OP_UNION:
- opPos = diagnoseXPathMultiOperation2("OP_UNION",
xpath.OP_LOCATIONPATH, xpath, opPos, indent);
- break;
- case xpath.OP_LITERAL:
- opPos = diagnoseXPathSimpleOperation2("OP_LITERAL", xpath, opPos,
indent);
- break;
- case xpath.OP_VARIABLE:
- opPos = diagnoseXPathSimpleOperation2("OP_VARIABLE", xpath, opPos,
indent);
- break;
- case xpath.OP_GROUP:
- opPos = diagnoseXPathUnaryOperation2("OP_GROUP", xpath, opPos,
indent);
- break;
- case xpath.OP_NUMBERLIT:
- opPos = diagnoseXPathSimpleOperation2("OP_NUMBERLIT", xpath, opPos,
indent);
- break;
- case xpath.OP_ARGUMENT:
- opPos = diagnoseXPathUnaryOperation2("OP_ARGUMENT", xpath, opPos,
indent);
- break;
- case xpath.OP_EXTFUNCTION:
- {
- diagnoseOp2SameLine("OP_EXTFUNCTION", xpath, opPos);
- int endExtFunc = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- opPos = diagnoseToken2SameLine(xpath, opPos);
- opPos = diagnoseToken2(xpath, opPos);
- while(opPos < endExtFunc)
- {
- opPos = diagnoseXPath2(xpath, opPos, indent+2);
- }
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- indent(indent+1);
- diagnoseOpOnly2(opPos, "ENDOP");
- opPos++;
- }
- break;
- case xpath.OP_FUNCTION:
- {
- diagnoseOp2SameLine("OP_FUNCTION", xpath, opPos);
- int endFunc = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- int funcID = xpath.m_opMap[opPos];
- switch(funcID)
- {
- case xpath.FUNC_LAST: diagnoseOpNoLable2(opPos, "FUNC_LAST");
break;
- case xpath.FUNC_POSITION: diagnoseOpNoLable2(opPos,
"FUNC_POSITION"); break;
- case xpath.FUNC_COUNT: diagnoseOpNoLable2(opPos, "FUNC_COUNT");
break;
- case xpath.FUNC_ID: diagnoseOpNoLable2(opPos, "FUNC_ID"); break;
- case xpath.FUNC_KEY: diagnoseOpNoLable2(opPos, "FUNC_KEY");
break;
- case xpath.FUNC_DOC: diagnoseOpNoLable2(opPos, "FUNC_DOC");
break;
- case xpath.FUNC_LOCAL_PART: diagnoseOpNoLable2(opPos,
"FUNC_LOCAL_PART"); break;
- case xpath.FUNC_NAMESPACE: diagnoseOpNoLable2(opPos,
"FUNC_NAMESPACE"); break;
- case xpath.FUNC_QNAME: diagnoseOpNoLable2(opPos, "FUNC_QNAME");
break;
- case xpath.FUNC_GENERATE_ID: diagnoseOpNoLable2(opPos,
"FUNC_GENERATE_ID"); break;
- case xpath.FUNC_NOT: diagnoseOpNoLable2(opPos, "FUNC_NOT");
break;
- case xpath.FUNC_TRUE: diagnoseOpNoLable2(opPos, "FUNC_TRUE");
break;
- case xpath.FUNC_FALSE: diagnoseOpNoLable2(opPos, "FUNC_FALSE");
break;
- case xpath.FUNC_BOOLEAN: diagnoseOpNoLable2(opPos,
"FUNC_BOOLEAN"); break;
- case xpath.FUNC_LANG: diagnoseOpNoLable2(opPos, "FUNC_LANG");
break;
- case xpath.FUNC_NUMBER: diagnoseOpNoLable2(opPos,
"FUNC_NUMBER"); break;
- case xpath.FUNC_FLOOR: diagnoseOpNoLable2(opPos, "FUNC_FLOOR");
break;
- case xpath.FUNC_CEILING: diagnoseOpNoLable2(opPos,
"FUNC_CEILING"); break;
- case xpath.FUNC_ROUND: diagnoseOpNoLable2(opPos, "FUNC_ROUND");
break;
- case xpath.FUNC_SUM: diagnoseOpNoLable2(opPos, "FUNC_SUM");
break;
- case xpath.FUNC_STRING: diagnoseOpNoLable2(opPos,
"FUNC_STRING"); break;
- case xpath.FUNC_STARTS_WITH: diagnoseOpNoLable2(opPos,
"FUNC_STARTS_WITH"); break;
- case xpath.FUNC_CONTAINS: diagnoseOpNoLable2(opPos,
"FUNC_CONTAINS"); break;
- case xpath.FUNC_SUBSTRING_BEFORE: diagnoseOpNoLable2(opPos,
"FUNC_SUBSTRING_BEFORE"); break;
- case xpath.FUNC_SUBSTRING_AFTER: diagnoseOpNoLable2(opPos,
"FUNC_SUBSTRING_AFTER"); break;
- case xpath.FUNC_NORMALIZE: diagnoseOpNoLable2(opPos,
"FUNC_NORMALIZE"); break;
- case xpath.FUNC_TRANSLATE: diagnoseOpNoLable2(opPos,
"FUNC_TRANSLATE"); break;
- case xpath.FUNC_CONCAT: diagnoseOpNoLable2(opPos,
"FUNC_CONCAT"); break;
- case xpath.FUNC_FORMAT_NUMBER: diagnoseOpNoLable2(opPos,
"FUNC_FORMAT_NUMBER"); break;
- case xpath.FUNC_SYSTEM_PROPERTY: diagnoseOpNoLable2(opPos,
"FUNC_SYSTEM_PROPERTY"); break;
- case xpath.FUNC_EXT_FUNCTION_AVAILABLE:
diagnoseOpNoLable2(opPos, "FUNC_EXT_FUNCTION_AVAILABLE"); break;
- case xpath.FUNC_EXT_ELEM_AVAILABLE: diagnoseOpNoLable2(opPos,
"FUNC_EXT_ELEM_AVAILABLE"); break;
- case xpath.FUNC_SUBSTRING: diagnoseOpNoLable2(opPos,
"FUNC_SUBSTRING"); break;
- case xpath.FUNC_STRING_LENGTH: diagnoseOpNoLable2(opPos,
"FUNC_STRING_LENGTH"); break;
- case xpath.FUNC_DOCLOCATION: diagnoseOpNoLable2(opPos,
"FUNC_DOCLOCATION"); break;
- }
- opPos++;
- while(opPos < endFunc)
- {
- // indent(indent+1);
- opPos = diagnoseXPath2(xpath, opPos, indent+2);
- }
- indent(indent);
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- indent(indent+1);
- diagnoseOpOnly2(opPos, "ENDOP");
- opPos++;
- }
- break;
- case xpath.OP_LOCATIONPATH:
- diagnoseOp2("OP_LOCATIONPATH", xpath, opPos);
- int endPath = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- while(opPos < endPath)
- {
- opPos = diagnoseXPath2(xpath, opPos, indent+1);
- }
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- indent(indent+1);
- diagnoseOpOnly2(opPos, "ENDOP");
- opPos++;
- break;
- case xpath.OP_PREDICATE:
- indent(1);
- opPos = diagnoseXPathUnaryOperation2("OP_PREDICATE", xpath, opPos,
indent+1);
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- indent(indent+2);
- diagnoseOpOnly2(opPos, "ENDOP");
- opPos++;
- break;
- case xpath.FROM_ANCESTORS:
- opPos = diagnoseXPathLocationStep2("FROM_ANCESTORS", xpath, opPos, 1);
- break;
- case xpath.FROM_ANCESTORS_OR_SELF:
- opPos = diagnoseXPathLocationStep2("FROM_ANCESTORS_OR_SELF", xpath,
opPos, 1);
- break;
- case xpath.FROM_ATTRIBUTES:
- opPos = diagnoseXPathLocationStep2("FROM_ATTRIBUTES", xpath, opPos,
1);
- break;
- case xpath.FROM_CHILDREN:
- opPos = diagnoseXPathLocationStep2("FROM_CHILDREN", xpath, opPos, 1);
- break;
- case xpath.FROM_DESCENDANTS:
- opPos = diagnoseXPathLocationStep2("FROM_DESCENDANTS", xpath, opPos,
1);
- break;
- case xpath.FROM_DESCENDANTS_OR_SELF:
- opPos = diagnoseXPathLocationStep2("FROM_DESCENDANTS_OR_SELF", xpath,
opPos, 1);
- break;
- case xpath.FROM_FOLLOWING:
- opPos = diagnoseXPathLocationStep2("FROM_FOLLOWING", xpath, opPos,
indent);
- break;
- case xpath.FROM_FOLLOWING_SIBLINGS:
- opPos = diagnoseXPathLocationStep2("FROM_FOLLOWING_SIBLINGS", xpath,
opPos, indent);
- break;
- case xpath.FROM_PARENT:
- opPos = diagnoseXPathLocationStep2("FROM_PARENT", xpath, opPos,
indent);
- break;
- case xpath.FROM_PRECEDING:
- opPos = diagnoseXPathLocationStep2("FROM_PRECEDING", xpath, opPos,
indent);
- break;
- case xpath.FROM_PRECEDING_SIBLINGS:
- opPos = diagnoseXPathLocationStep2("FROM_PRECEDING_SIBLINGS", xpath,
opPos, indent);
- break;
- case xpath.FROM_SELF:
- opPos = diagnoseXPathLocationStep2("FROM_SELF", xpath, opPos, indent);
- break;
- case xpath.FROM_NAMESPACE:
- opPos = diagnoseXPathLocationStep2("FROM_NAMESPACE", xpath, opPos,
indent);
- break;
- // case xpath.FROM_ATTRIBUTE:
- // opPos = diagnoseXPathLocationStep("FROM_ATTRIBUTE", xpath,
opPos, indent);
- // break;
- // case xpath.FROM_DOC:
- // opPos = diagnoseXPathLocationStep("FROM_DOC", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_DOCREF:
- // opPos = diagnoseXPathLocationStep("FROM_DOCREF", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_ID:
- // opPos = diagnoseXPathLocationStep("FROM_ID", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_IDREF:
- // opPos = diagnoseXPathLocationStep("FROM_IDREF", xpath, opPos,
indent);
- // break;
- case xpath.FROM_ROOT:
- opPos = diagnoseXPathLocationStep2("FROM_ROOT", xpath, opPos, indent);
- // opPos++;
- break;
- case xpath.NODETYPE_COMMENT:
- diagnoseNodeTest2(opPos, "NODETYPE_COMMENT");
- System.out.println();
- opPos++;
- break;
- case xpath.NODETYPE_TEXT:
- diagnoseNodeTest2(opPos, "NODETYPE_TEXT");
- System.out.println();
- opPos++;
- break;
- case xpath.NODETYPE_PI:
- int piLen = xpath.m_opMap[opPos-1];
- diagnoseNodeTest2(opPos, "NODETYPE_PI");
- opPos++;
- if(piLen > 3)
- {
- opPos = diagnoseToken(xpath, opPos);
- }
- break;
- case xpath.NODETYPE_NODE:
- diagnoseNodeTest2(opPos, "NODETYPE_NODE");
- System.out.println();
- opPos++;
- break;
- case xpath.NODETYPE_ROOT:
- diagnoseNodeTest2(opPos, "NODETYPE_ROOT");
- System.out.println();
- opPos++;
- break;
- case xpath.NODETYPE_ANYELEMENT:
- diagnoseNodeTest2(opPos, "NODETYPE_ANYELEMENT");
- System.out.println();
- opPos++;
- break;
- case xpath.NODENAME:
- diagnoseNodeTest2(opPos, "NODENAME");
- opPos++;
- if(xpath.m_opMap[opPos] < 0)
- {
- System.out.print(m_noLabel+"EMPTY"+m_close);
- opPos++;
- }
- else
- {
- opPos = diagnoseToken2(xpath, opPos);
- }
- opPos = diagnoseToken2(xpath, opPos);
- break;
- default:
- System.out.println("ERROR! Unknown op code: "+xpath.m_opMap[opPos]);
- }
- return opPos;
- }
-
-
-#endif
1.4 +52 -1012 xml-xalan/c/src/XPath/XPathProcessorImpl.hpp
Index: XPathProcessorImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XPathProcessorImpl.hpp 2000/03/03 19:00:21 1.3
+++ XPathProcessorImpl.hpp 2000/04/11 14:46:21 1.4
@@ -70,8 +70,7 @@
-#include <dom/DOMString.hpp>
-#include <dom/DOM_Node.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -84,6 +83,10 @@
+class XalanNode;
+
+
+
/**
* The XPathProcessorImpl class responsibilities include tokenizing and
* parsing the XPath expression, and acting as a general interface to XPaths.
@@ -97,11 +100,11 @@
#else
# define XALAN_STD std::
#endif
- typedef XALAN_STD map<DOMString, int>
KeywordsMapType;
- typedef XALAN_STD map<DOMString, XPathExpression::eOpCodes>
FunctionNameMapType;
- typedef XALAN_STD map<DOMString, XPathExpression::eOpCodes>
AxisNamesMapType;
- typedef XALAN_STD map<DOMString, XPathExpression::eOpCodes>
NodeTypesMapType;
- typedef XALAN_STD vector<DOMString> DOMStringVectorType;
+ typedef XALAN_STD map<XalanDOMString, int>
KeywordsMapType;
+ typedef XALAN_STD map<XalanDOMString, XPathExpression::eOpCodes>
FunctionNameMapType;
+ typedef XALAN_STD map<XalanDOMString, XPathExpression::eOpCodes>
AxisNamesMapType;
+ typedef XALAN_STD map<XalanDOMString, XPathExpression::eOpCodes>
NodeTypesMapType;
+ typedef XALAN_STD vector<XalanDOMString>
DOMStringVectorType;
#undef XALAN_STD
@@ -117,7 +120,7 @@
virtual void
initXPath(
XPath& pathObj,
- const DOMString& expression,
+ const XalanDOMString& expression,
const PrefixResolver& prefixResolver,
XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport);
@@ -125,7 +128,7 @@
virtual void
initMatchPattern(
XPath& pathObj,
- const DOMString& expression,
+ const XalanDOMString& expression,
const PrefixResolver& prefixResolver,
XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport);
@@ -141,8 +144,8 @@
*/
void
tokenize(
- const DOMString& pat,
- DOMStringVectorType* targetStrings = 0);
+ const XalanDOMString& pat,
+ DOMStringVectorType* targetStrings = 0);
/**
* Record the current position on the token queue as long as this is a
@@ -162,7 +165,7 @@
recordTokenString(DOMStringVectorType& targetStrings);
void
- addToTokenQueue(const DOMString& s) const;
+ addToTokenQueue(const XalanDOMString& s) const;
/**
* When a separator token is found, see if there's a element name or the
@@ -170,10 +173,10 @@
*/
int
mapNSTokens(
- const DOMString& pat,
- int startSubstring,
- int posOfNSSep,
- int posOfScan)
const;
+ const XalanDOMString& pat,
+ int
startSubstring,
+ int
posOfNSSep,
+ int
posOfScan) const;
/**
* Given a map pos, return the corresponding token queue pos.
@@ -227,7 +230,7 @@
* if s is also null).
*/
bool
- tokenIs(const char* s) const;
+ tokenIs(const XalanDOMString& s) const;
/**
* Check if m_token==s. If m_token is null, this won't throw
@@ -235,6 +238,14 @@
* if s is also null).
*/
bool
+ tokenIs(const XalanDOMChar* s) const;
+
+ /**
+ * Check if m_token==s. If m_token is null, this won't throw
+ * an exception, instead it just returns false (or true
+ * if s is also null).
+ */
+ bool
tokenIs(char c) const;
/**
@@ -258,10 +269,22 @@
*/
bool
lookahead(
- const char* s,
- int n) const;
+ const XalanDOMChar* s,
+ int n)
const;
/**
+ * Lookahead of the current token in order to
+ * make a branching decision.
+ * @param s the string to compare it to.
+ * @param n number of tokens to lookahead. Must be
+ * greater than 1.
+ */
+ bool
+ lookahead(
+ const XalanDOMString& s,
+ int n)
const;
+
+ /**
* Lookbehind the first character of the current token in order to
* make a branching decision.
* @param c the character to compare it to.
@@ -300,7 +323,7 @@
* Retrieve the next token from the command and
* store it in m_token string.
*/
- DOMString
+ XalanDOMString
getTokenRelative(int theOffset) const;
/**
@@ -336,8 +359,8 @@
*/
void
warn(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ XalanNode* sourceNode = 0)
const;
/**
* Tell the user of an error, and probably throw an
@@ -345,170 +368,20 @@
*/
void
error(
- const DOMString& msg,
- const DOM_Node& sourceNode = DOM_Node()) const;
+ const XalanDOMString& msg,
+ XalanNode* sourceNode = 0)
const;
-#if 0
-
- private static final String FROM_ANCESTORS_STRING = "ancestor";
- private static final String FROM_ANCESTORS_OR_SELF_STRING =
"ancestor-or-self";
- private static final String FROM_ATTRIBUTES_STRING = "attribute";
- private static final String FROM_CHILDREN_STRING = "child";
- private static final String FROM_DESCENDANTS_STRING = "descendant";
- private static final String FROM_DESCENDANTS_OR_SELF_STRING =
"descendant-or-self";
- private static final String FROM_FOLLOWING_STRING = "following";
- private static final String FROM_FOLLOWING_SIBLINGS_STRING =
"following-sibling";
- private static final String FROM_PARENT_STRING = "parent";
- private static final String FROM_PRECEDING_STRING = "preceding";
- private static final String FROM_PRECEDING_SIBLINGS_STRING =
"preceding-sibling";
- private static final String FROM_SELF_STRING = "self";
- private static final String FROM_NAMESPACE_STRING = "namespace";
-
- private static final String FROM_SELF_ABBREVIATED_STRING = ".";
- private static final String NODETYPE_COMMENT_STRING = "comment";
- private static final String NODETYPE_TEXT_STRING = "text";
- private static final String NODETYPE_PI_STRING = "processing-instruction";
- private static final String NODETYPE_NODE_STRING = "node";
- private static final String FROM_ATTRIBUTE_STRING = "@";
- private static final String FROM_DOC_STRING = "document";
- private static final String FROM_DOCREF_STRING = "document";
- private static final String FROM_ID_STRING = "id";
- private static final String FROM_IDREF_STRING = "idref";
- private static final String NODETYPE_ANYELEMENT_STRING = "*";
- private static final String FUNC_CURRENT_STRING = "current";
- private static final String FUNC_LAST_STRING = "last";
- private static final String FUNC_POSITION_STRING = "position";
- private static final String FUNC_COUNT_STRING = "count";
- private static final String FUNC_ID_STRING = "id";
- private static final String FUNC_IDREF_STRING = "idref";
- private static final String FUNC_KEY_STRING = "key";
- private static final String FUNC_KEYREF_STRING = "keyref";
- private static final String FUNC_DOC_STRING = "doc";
- private static final String FUNC_DOCUMENT_STRING = "document";
- private static final String FUNC_DOCREF_STRING = "docref";
- private static final String FUNC_LOCAL_PART_STRING = "local-name";
- private static final String FUNC_NAMESPACE_STRING = "namespace-uri";
- private static final String FUNC_NAME_STRING = "name";
- private static final String FUNC_GENERATE_ID_STRING = "generate-id";
- private static final String FUNC_NOT_STRING = "not";
- private static final String FUNC_TRUE_STRING = "true";
- private static final String FUNC_FALSE_STRING = "false";
- private static final String FUNC_BOOLEAN_STRING = "boolean";
- private static final String FUNC_LANG_STRING = "lang";
- private static final String FUNC_NUMBER_STRING = "number";
- private static final String FUNC_FLOOR_STRING = "floor";
- private static final String FUNC_CEILING_STRING = "ceiling";
- private static final String FUNC_ROUND_STRING = "round";
- private static final String FUNC_SUM_STRING = "sum";
- private static final String FUNC_STRING_STRING = "string";
- private static final String FUNC_STARTS_WITH_STRING = "starts-with";
- private static final String FUNC_CONTAINS_STRING = "contains";
- private static final String FUNC_SUBSTRING_BEFORE_STRING =
"substring-before";
- private static final String FUNC_SUBSTRING_AFTER_STRING =
"substring-after";
- private static final String FUNC_NORMALIZE_STRING = "normalize";
- private static final String FUNC_TRANSLATE_STRING = "translate";
- private static final String FUNC_CONCAT_STRING = "concat";
- private static final String FUNC_FORMAT_NUMBER_STRING = "format-number";
- private static final String FUNC_SYSTEM_PROPERTY_STRING =
"system-property";
- private static final String FUNC_EXT_FUNCTION_AVAILABLE_STRING =
"extension-function-available";
- private static final String FUNC_EXT_ELEM_AVAILABLE_STRING =
"extension-element-available";
- private static final String FUNC_SUBSTRING_STRING = "substring";
- private static final String FUNC_STRING_LENGTH_STRING = "string-length";
-
- // Proprietary, built in functions
- private static final String FUNC_DOCLOCATION_STRING = "document-location";
-
- static
- {
- m_axisnames.put((FROM_ANCESTORS_STRING).intern(), new
Integer(XPath.FROM_ANCESTORS));
- m_axisnames.put((FROM_ANCESTORS_OR_SELF_STRING).intern(), new
Integer(XPath.FROM_ANCESTORS_OR_SELF));
- m_axisnames.put((FROM_ATTRIBUTES_STRING).intern(), new
Integer(XPath.FROM_ATTRIBUTES));
- m_axisnames.put((FROM_CHILDREN_STRING).intern(), new
Integer(XPath.FROM_CHILDREN));
- m_axisnames.put((FROM_DESCENDANTS_STRING).intern(), new
Integer(XPath.FROM_DESCENDANTS));
- m_axisnames.put((FROM_DESCENDANTS_OR_SELF_STRING).intern(), new
Integer(XPath.FROM_DESCENDANTS_OR_SELF));
- m_axisnames.put((FROM_FOLLOWING_STRING).intern(), new
Integer(XPath.FROM_FOLLOWING));
- m_axisnames.put((FROM_FOLLOWING_SIBLINGS_STRING).intern(), new
Integer(XPath.FROM_FOLLOWING_SIBLINGS));
- m_axisnames.put((FROM_PARENT_STRING).intern(), new
Integer(XPath.FROM_PARENT));
- m_axisnames.put((FROM_PRECEDING_STRING).intern(), new
Integer(XPath.FROM_PRECEDING));
- m_axisnames.put((FROM_PRECEDING_SIBLINGS_STRING).intern(), new
Integer(XPath.FROM_PRECEDING_SIBLINGS));
- m_axisnames.put((FROM_SELF_STRING).intern(), new
Integer(XPath.FROM_SELF));
- m_axisnames.put((FROM_NAMESPACE_STRING).intern(), new
Integer(XPath.FROM_NAMESPACE));
-
- m_nodetypes.put((NODETYPE_COMMENT_STRING).intern(), new
Integer(XPath.NODETYPE_COMMENT));
- m_nodetypes.put((NODETYPE_TEXT_STRING).intern(), new
Integer(XPath.NODETYPE_TEXT));
- m_nodetypes.put((NODETYPE_PI_STRING).intern(), new
Integer(XPath.NODETYPE_PI));
- m_nodetypes.put((NODETYPE_NODE_STRING).intern(), new
Integer(XPath.NODETYPE_NODE));
- m_nodetypes.put((NODETYPE_ANYELEMENT_STRING).intern(), new
Integer(XPath.NODETYPE_ANYELEMENT));
-
- m_keywords.put((FROM_SELF_ABBREVIATED_STRING).intern(), new
Integer(XPath.FROM_SELF));
- // m_keywords.put((FROM_ATTRIBUTE_STRING).intern(), new
Integer(XPath.FROM_ATTRIBUTE));
- // m_keywords.put((FROM_DOC_STRING).intern(), new
Integer(XPath.FROM_DOC));
- // m_keywords.put((FROM_DOCREF_STRING).intern(), new
Integer(XPath.FROM_DOCREF));
- // m_keywords.put((FROM_ID_STRING).intern(), new
Integer(XPath.FROM_ID));
- // m_keywords.put((FROM_IDREF_STRING).intern(), new
Integer(XPath.FROM_IDREF));
-
- m_keywords.put((FUNC_ID_STRING).intern(), new Integer(XPath.FUNC_ID));
- m_keywords.put((FUNC_KEY_STRING).intern(), new Integer(XPath.FUNC_KEY));
- m_keywords.put((FUNC_DOCUMENT_STRING).intern(), new
Integer(XPath.FUNC_DOC));
-
- m_functions.put((FUNC_CURRENT_STRING).intern(), new
Integer(XPath.FUNC_CURRENT));
- m_functions.put((FUNC_LAST_STRING).intern(), new
Integer(XPath.FUNC_LAST));
- m_functions.put((FUNC_POSITION_STRING).intern(), new
Integer(XPath.FUNC_POSITION));
- m_functions.put((FUNC_COUNT_STRING).intern(), new
Integer(XPath.FUNC_COUNT));
- m_functions.put((FUNC_ID_STRING).intern(), new Integer(XPath.FUNC_ID));
- m_functions.put((FUNC_KEY_STRING).intern(), new
Integer(XPath.FUNC_KEY));
- m_functions.put((FUNC_DOCUMENT_STRING).intern(), new
Integer(XPath.FUNC_DOC));
- m_functions.put((FUNC_LOCAL_PART_STRING).intern(), new
Integer(XPath.FUNC_LOCAL_PART));
- m_functions.put((FUNC_NAMESPACE_STRING).intern(), new
Integer(XPath.FUNC_NAMESPACE));
- m_functions.put((FUNC_NAME_STRING).intern(), new
Integer(XPath.FUNC_QNAME));
- m_functions.put((FUNC_GENERATE_ID_STRING).intern(), new
Integer(XPath.FUNC_GENERATE_ID));
- m_functions.put((FUNC_NOT_STRING).intern(), new
Integer(XPath.FUNC_NOT));
- m_functions.put((FUNC_TRUE_STRING).intern(), new
Integer(XPath.FUNC_TRUE));
- m_functions.put((FUNC_FALSE_STRING).intern(), new
Integer(XPath.FUNC_FALSE));
- m_functions.put((FUNC_BOOLEAN_STRING).intern(), new
Integer(XPath.FUNC_BOOLEAN));
- m_functions.put((FUNC_LANG_STRING).intern(), new
Integer(XPath.FUNC_LANG));
- m_functions.put((FUNC_NUMBER_STRING).intern(), new
Integer(XPath.FUNC_NUMBER));
- m_functions.put((FUNC_FLOOR_STRING).intern(), new
Integer(XPath.FUNC_FLOOR));
- m_functions.put((FUNC_CEILING_STRING).intern(), new
Integer(XPath.FUNC_CEILING));
- m_functions.put((FUNC_ROUND_STRING).intern(), new
Integer(XPath.FUNC_ROUND));
- m_functions.put((FUNC_SUM_STRING).intern(), new
Integer(XPath.FUNC_SUM));
- m_functions.put((FUNC_STRING_STRING).intern(), new
Integer(XPath.FUNC_STRING));
- m_functions.put((FUNC_STARTS_WITH_STRING).intern(), new
Integer(XPath.FUNC_STARTS_WITH));
- m_functions.put((FUNC_CONTAINS_STRING).intern(), new
Integer(XPath.FUNC_CONTAINS));
- m_functions.put((FUNC_SUBSTRING_BEFORE_STRING).intern(), new
Integer(XPath.FUNC_SUBSTRING_BEFORE));
- m_functions.put((FUNC_SUBSTRING_AFTER_STRING).intern(), new
Integer(XPath.FUNC_SUBSTRING_AFTER));
- m_functions.put((FUNC_NORMALIZE_STRING).intern(), new
Integer(XPath.FUNC_NORMALIZE));
- m_functions.put((FUNC_TRANSLATE_STRING).intern(), new
Integer(XPath.FUNC_TRANSLATE));
- m_functions.put((FUNC_CONCAT_STRING).intern(), new
Integer(XPath.FUNC_CONCAT));
- m_functions.put((FUNC_FORMAT_NUMBER_STRING).intern(), new
Integer(XPath.FUNC_FORMAT_NUMBER));
- m_functions.put((FUNC_SYSTEM_PROPERTY_STRING).intern(), new
Integer(XPath.FUNC_SYSTEM_PROPERTY));
- m_functions.put((FUNC_EXT_FUNCTION_AVAILABLE_STRING).intern(), new
Integer(XPath.FUNC_EXT_FUNCTION_AVAILABLE));
- m_functions.put((FUNC_EXT_ELEM_AVAILABLE_STRING).intern(), new
Integer(XPath.FUNC_EXT_ELEM_AVAILABLE));
- m_functions.put((FUNC_SUBSTRING_STRING).intern(), new
Integer(XPath.FUNC_SUBSTRING));
- m_functions.put((FUNC_STRING_LENGTH_STRING).intern(), new
Integer(XPath.FUNC_STRING_LENGTH));
-
- // These aren't really functions.
- m_functions.put((NODETYPE_COMMENT_STRING).intern(), new
Integer(XPath.NODETYPE_COMMENT));
- m_functions.put((NODETYPE_TEXT_STRING).intern(), new
Integer(XPath.NODETYPE_TEXT));
- m_functions.put((NODETYPE_PI_STRING).intern(), new
Integer(XPath.NODETYPE_PI));
- m_functions.put((NODETYPE_NODE_STRING).intern(), new
Integer(XPath.NODETYPE_NODE));
-
- m_functions.put((FUNC_DOCLOCATION_STRING).intern(), new
Integer(XPath.FUNC_DOCLOCATION));
- }
-#endif
-
-
/**
* Given a string, return the corresponding token.
*/
int
- getKeywordToken(const DOMString& key) const;
+ getKeywordToken(const XalanDOMString& key) const;
/**
* Given a string, return the corresponding token.
*/
int
- getFunctionToken(const DOMString& key) const;
+ getFunctionToken(const XalanDOMString& key) const;
/**
*
@@ -861,840 +734,7 @@
AbbreviatedNodeTestStep();
bool
- isValidFunction(const DOMString& key) const;
-
-#if 0
- private void ____DIAGNOSTIC_FUNCTIONS____(){}
-
- public static void diagnoseXPathString( String str )
- {
- XPathSupport callbacks = new XPathSupportDefault();
- XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
- XPath xpath = new XPath(callbacks);
- processor.initXPath(xpath, str, null);
- processor.diagnoseXPath(xpath, 0, 0);
- }
-
- static int diagnoseXPathBinaryOperation(String op, XPath xpath, int opPos,
int indent)
- {
- System.out.println(op+" {");
- opPos+=2;
-
- opPos = diagnoseXPath(xpath, opPos, indent+1);
-
- opPos = diagnoseXPath(xpath, opPos, indent+1);
-
- indent(indent);
- System.out.println("}");
- return opPos;
- }
-
- static int diagnoseXPathUnaryOperation(String op, XPath xpath, int opPos,
int indent)
- {
- System.out.println(op+" {");
- opPos+=2;
- opPos = diagnoseXPath(xpath, opPos, indent+1);
- indent(indent);
- System.out.println("}");
- return opPos;
- }
-
- static int diagnoseXPathMultiOperation(String op, int multiOp, XPath
xpath, int opPos, int indent)
- {
- System.out.println(op+" {");
- opPos+=2;
- while(xpath.m_opMap[opPos] == multiOp)
- {
- indent(indent+1);
- System.out.println("{");
- opPos = diagnoseXPath(xpath, opPos, indent+2);
- indent(indent+1);
- System.out.println("}");
- }
- indent(indent);
- System.out.println("}");
- return opPos;
- }
-
- static int diagnoseToken(XPath xpath, int opPos)
- {
- System.out.print("{");
- System.out.print(xpath.m_tokenQueue[xpath.m_opMap[opPos]]);
- System.out.print("}");
- return opPos+1;
- }
-
- static int diagnoseXPathSimpleOperation(String op, XPath xpath, int opPos,
int indent)
- {
- opPos+=2;
- System.out.print(op);
- opPos = diagnoseToken(xpath, opPos);
- System.out.println("");
- return opPos;
- }
-
- static int diagnoseXPathLocationStep(String op, XPath xpath, int opPos,
int indent)
- {
- // int opLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH];
- int stepLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH+1];
- opPos+=3;
- System.out.print(op);
- if(stepLen > 3)
- {
- opPos = diagnoseXPath(xpath, opPos, 1);
- }
- System.out.println("");
- return opPos;
- }
-
- static int diagnoseXPath(XPath xpath, int opPos, int indent)
- {
- indent(indent);
- switch(xpath.m_opMap[opPos])
- {
- case xpath.OP_XPATH:
- opPos = diagnoseXPathUnaryOperation("OP_XPATH", xpath, opPos, indent);
- break;
- case xpath.EMPTY:
- System.out.println("{EMPTY}");
- opPos++;
- break;
- case xpath.OP_OR:
- opPos = diagnoseXPathBinaryOperation("OP_OR", xpath, opPos, indent);
- break;
- case xpath.OP_AND:
- opPos = diagnoseXPathBinaryOperation("OP_AND", xpath, opPos, indent);
- break;
- case xpath.OP_NOTEQUALS:
- opPos = diagnoseXPathBinaryOperation("OP_NOTEQUALS", xpath, opPos,
indent);
- break;
- case xpath.OP_EQUALS:
- opPos = diagnoseXPathBinaryOperation("OP_EQUALS", xpath, opPos,
indent);
- break;
- case xpath.OP_LTE:
- opPos = diagnoseXPathBinaryOperation("OP_LTE", xpath, opPos, indent);
- break;
- case xpath.OP_LT:
- opPos = diagnoseXPathBinaryOperation("OP_LT", xpath, opPos, indent);
- break;
- case xpath.OP_GTE:
- opPos = diagnoseXPathBinaryOperation("OP_GTE", xpath, opPos, indent);
- break;
- case xpath.OP_GT:
- opPos = diagnoseXPathBinaryOperation("OP_GT", xpath, opPos, indent);
- break;
- case xpath.OP_PLUS:
- opPos = diagnoseXPathBinaryOperation("OP_PLUS", xpath, opPos, indent);
- break;
- case xpath.OP_MINUS:
- opPos = diagnoseXPathBinaryOperation("OP_MINUS", xpath, opPos,
indent);
- break;
- case xpath.OP_MULT:
- opPos = diagnoseXPathBinaryOperation("OP_MULT", xpath, opPos, indent);
- break;
- case xpath.OP_DIV:
- opPos = diagnoseXPathBinaryOperation("OP_DIV", xpath, opPos, indent);
- break;
- case xpath.OP_MOD:
- opPos = diagnoseXPathBinaryOperation("OP_MOD", xpath, opPos, indent);
- break;
- case xpath.OP_QUO:
- opPos = diagnoseXPathBinaryOperation("OP_QUO", xpath, opPos, indent);
- break;
- case xpath.OP_NEG:
- opPos = diagnoseXPathUnaryOperation("OP_NEG", xpath, opPos, indent);
- break;
- case xpath.OP_STRING:
- opPos = diagnoseXPathUnaryOperation("OP_STRING", xpath, opPos,
indent);
- break;
- case xpath.OP_BOOL:
- opPos = diagnoseXPathUnaryOperation("OP_BOOL", xpath, opPos, indent);
- break;
- case xpath.OP_NUMBER:
- opPos = diagnoseXPathUnaryOperation("OP_NUMBER", xpath, opPos,
indent);
- break;
- case xpath.OP_UNION:
- opPos = diagnoseXPathMultiOperation("OP_UNION",
xpath.OP_LOCATIONPATH, xpath, opPos, indent);
- break;
- case xpath.OP_LITERAL:
- opPos = diagnoseXPathSimpleOperation("OP_LITERAL", xpath, opPos,
indent);
- break;
- case xpath.OP_VARIABLE:
- opPos = diagnoseXPathSimpleOperation("OP_VARIABLE", xpath, opPos,
indent);
- break;
- case xpath.OP_GROUP:
- opPos = diagnoseXPathUnaryOperation("OP_GROUP", xpath, opPos, indent);
- break;
- case xpath.OP_NUMBERLIT:
- opPos = diagnoseXPathSimpleOperation("OP_NUMBERLIT", xpath, opPos,
indent);
- break;
- case xpath.OP_ARGUMENT:
- opPos = diagnoseXPathUnaryOperation("OP_ARGUMENT", xpath, opPos,
indent);
- break;
- case xpath.OP_EXTFUNCTION:
- {
- System.out.println("OP_EXTFUNCTION {");
- int endExtFunc = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- indent(indent+1);
- opPos = diagnoseToken(xpath, opPos);
- System.out.print(":");
- opPos = diagnoseToken(xpath, opPos);
- System.out.println("");
- while(opPos < endExtFunc)
- {
- indent(indent+1);
- System.out.println("{");
- opPos = diagnoseXPath(xpath, opPos, indent+2);
- indent(indent+1);
- System.out.println("}");
- }
- indent(indent);
- System.out.println("}");
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- opPos++;
- }
- break;
- case xpath.OP_FUNCTION:
- {
- System.out.println("OP_FUNCTION {");
- int endFunc = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- indent(indent+1);
- int funcID = xpath.m_opMap[opPos];
- switch(funcID)
- {
- case xpath.FUNC_LAST: System.out.print("FUNC_LAST"); break;
- case xpath.FUNC_POSITION: System.out.print("FUNC_POSITION");
break;
- case xpath.FUNC_COUNT: System.out.print("FUNC_COUNT"); break;
- case xpath.FUNC_ID: System.out.print("FUNC_ID"); break;
- case xpath.FUNC_KEY: System.out.print("FUNC_KEY"); break;
- case xpath.FUNC_DOC: System.out.print("FUNC_DOC"); break;
- case xpath.FUNC_LOCAL_PART:
System.out.print("FUNC_LOCAL_PART"); break;
- case xpath.FUNC_NAMESPACE: System.out.print("FUNC_NAMESPACE");
break;
- case xpath.FUNC_QNAME: System.out.print("FUNC_QNAME"); break;
- case xpath.FUNC_GENERATE_ID:
System.out.print("FUNC_GENERATE_ID"); break;
- case xpath.FUNC_NOT: System.out.print("FUNC_NOT"); break;
- case xpath.FUNC_TRUE: System.out.print("FUNC_TRUE"); break;
- case xpath.FUNC_FALSE: System.out.print("FUNC_FALSE"); break;
- case xpath.FUNC_BOOLEAN: System.out.print("FUNC_BOOLEAN");
break;
- case xpath.FUNC_LANG: System.out.print("FUNC_LANG"); break;
- case xpath.FUNC_NUMBER: System.out.print("FUNC_NUMBER"); break;
- case xpath.FUNC_FLOOR: System.out.print("FUNC_FLOOR"); break;
- case xpath.FUNC_CEILING: System.out.print("FUNC_CEILING");
break;
- case xpath.FUNC_ROUND: System.out.print("FUNC_ROUND"); break;
- case xpath.FUNC_SUM: System.out.print("FUNC_SUM"); break;
- case xpath.FUNC_STRING: System.out.print("FUNC_STRING"); break;
- case xpath.FUNC_STARTS_WITH:
System.out.print("FUNC_STARTS_WITH"); break;
- case xpath.FUNC_CONTAINS: System.out.print("FUNC_CONTAINS");
break;
- case xpath.FUNC_SUBSTRING_BEFORE:
System.out.print("FUNC_SUBSTRING_BEFORE"); break;
- case xpath.FUNC_SUBSTRING_AFTER:
System.out.print("FUNC_SUBSTRING_AFTER"); break;
- case xpath.FUNC_NORMALIZE: System.out.print("FUNC_NORMALIZE");
break;
- case xpath.FUNC_TRANSLATE: System.out.print("FUNC_TRANSLATE");
break;
- case xpath.FUNC_CONCAT: System.out.print("FUNC_CONCAT"); break;
- case xpath.FUNC_FORMAT_NUMBER:
System.out.print("FUNC_FORMAT_NUMBER"); break;
- case xpath.FUNC_SYSTEM_PROPERTY:
System.out.print("FUNC_SYSTEM_PROPERTY"); break;
- case xpath.FUNC_EXT_FUNCTION_AVAILABLE:
System.out.print("FUNC_EXT_FUNCTION_AVAILABLE"); break;
- case xpath.FUNC_EXT_ELEM_AVAILABLE:
System.out.print("FUNC_EXT_ELEM_AVAILABLE"); break;
- case xpath.FUNC_SUBSTRING: System.out.print("FUNC_SUBSTRING");
break;
- case xpath.FUNC_STRING_LENGTH:
System.out.print("FUNC_STRING_LENGTH"); break;
- case xpath.FUNC_DOCLOCATION:
System.out.print("FUNC_DOCLOCATION"); break;
- }
- opPos++;
- System.out.println("");
- while(opPos < endFunc)
- {
- indent(indent+1);
- System.out.println("{");
- opPos = diagnoseXPath(xpath, opPos, indent+2);
- indent(indent+1);
- System.out.println("}");
- }
- indent(indent);
- System.out.println("}");
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- opPos++;
- }
- break;
- case xpath.OP_LOCATIONPATH:
- System.out.println("OP_LOCATIONPATH"+" {");
- int endPath = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- while(opPos < endPath)
- {
- opPos = diagnoseXPath(xpath, opPos, indent+1);
- }
- indent(indent);
- System.out.println("}");
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- opPos++;
- break;
- case xpath.OP_PREDICATE:
- opPos = diagnoseXPathUnaryOperation("OP_PREDICATE", xpath, opPos,
indent);
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- opPos++;
- break;
- case xpath.FROM_ANCESTORS:
- opPos = diagnoseXPathLocationStep("FROM_ANCESTORS", xpath, opPos, 1);
- break;
- case xpath.FROM_ANCESTORS_OR_SELF:
- opPos = diagnoseXPathLocationStep("FROM_ANCESTORS_OR_SELF", xpath,
opPos, 1);
- break;
- case xpath.FROM_ATTRIBUTES:
- opPos = diagnoseXPathLocationStep("FROM_ATTRIBUTES", xpath, opPos, 1);
- break;
- case xpath.FROM_CHILDREN:
- opPos = diagnoseXPathLocationStep("FROM_CHILDREN", xpath, opPos, 1);
- break;
- case xpath.FROM_DESCENDANTS:
- opPos = diagnoseXPathLocationStep("FROM_DESCENDANTS", xpath, opPos,
1);
- break;
- case xpath.FROM_DESCENDANTS_OR_SELF:
- opPos = diagnoseXPathLocationStep("FROM_DESCENDANTS_OR_SELF", xpath,
opPos, 1);
- break;
- case xpath.FROM_FOLLOWING:
- opPos = diagnoseXPathLocationStep("FROM_FOLLOWING", xpath, opPos,
indent);
- break;
- case xpath.FROM_FOLLOWING_SIBLINGS:
- opPos = diagnoseXPathLocationStep("FROM_FOLLOWING_SIBLINGS", xpath,
opPos, indent);
- break;
- case xpath.FROM_PARENT:
- opPos = diagnoseXPathLocationStep("FROM_PARENT", xpath, opPos,
indent);
- break;
- case xpath.FROM_PRECEDING:
- opPos = diagnoseXPathLocationStep("FROM_PRECEDING", xpath, opPos,
indent);
- break;
- case xpath.FROM_PRECEDING_SIBLINGS:
- opPos = diagnoseXPathLocationStep("FROM_PRECEDING_SIBLINGS", xpath,
opPos, indent);
- break;
- case xpath.FROM_SELF:
- opPos = diagnoseXPathLocationStep("FROM_SELF", xpath, opPos, indent);
- break;
- case xpath.FROM_NAMESPACE:
- opPos = diagnoseXPathLocationStep("FROM_NAMESPACE", xpath, opPos,
indent);
- break;
- // case xpath.FROM_ATTRIBUTE:
- // opPos = diagnoseXPathLocationStep("FROM_ATTRIBUTE", xpath,
opPos, indent);
- // break;
- // case xpath.FROM_DOC:
- // opPos = diagnoseXPathLocationStep("FROM_DOC", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_DOCREF:
- // opPos = diagnoseXPathLocationStep("FROM_DOCREF", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_ID:
- // opPos = diagnoseXPathLocationStep("FROM_ID", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_IDREF:
- // opPos = diagnoseXPathLocationStep("FROM_IDREF", xpath, opPos,
indent);
- // break;
- case xpath.FROM_ROOT:
- opPos = diagnoseXPathLocationStep("FROM_ROOT", xpath, opPos, indent);
- break;
- case xpath.NODETYPE_COMMENT:
- System.out.println("{NODETYPE_COMMENT}");
- opPos++;
- break;
- case xpath.NODETYPE_TEXT:
- System.out.println("{NODETYPE_TEXT}");
- opPos++;
- break;
- case xpath.NODETYPE_PI:
- int piLen = xpath.m_opMap[opPos-1];
- System.out.println("{NODETYPE_PI ");
- opPos++;
- if(piLen > 3)
- {
- opPos = diagnoseToken(xpath, opPos);
- }
- break;
- case xpath.NODETYPE_NODE:
- System.out.println("{NODETYPE_NODE}");
- opPos++;
- break;
- case xpath.NODETYPE_ROOT:
- System.out.println("{NODETYPE_ROOT}");
- opPos++;
- break;
- case xpath.NODETYPE_ANYELEMENT:
- System.out.println("{NODETYPE_ANYELEMENT}");
- opPos++;
- break;
- case xpath.NODENAME:
- System.out.print("{NODENAME ");
- opPos++;
- if(xpath.m_opMap[opPos] < 0)
- {
- System.out.print("{EMPTY}");
- opPos++;
- }
- else
- {
- opPos = diagnoseToken(xpath, opPos);
- }
- System.out.print(":");
- opPos = diagnoseToken(xpath, opPos);
- break;
- default:
- System.out.println("ERROR! Unknown op code: "+xpath.m_opMap[opPos]);
- }
- return opPos;
- }
-
- static void indent(int amount)
- {
- int n = amount * 3;
- for(int i = 0; i < n; i ++)
- {
- System.out.print(" ");
- }
- }
-
- private static String m_opLabel = "[";
- private static String m_lenLabel = "[";
- private static String m_arglenLabel = "[";
- private static String m_noLabel = "[";
- private static String m_nTestLabel = "[";
- private static String m_open = "[";
- private static String m_close = "]";
-
- public static void diagnoseXPathString2( String str )
- {
- XPathSupport callbacks = new XPathSupportDefault();
- XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
- XPath xpath = new XPath(callbacks);
- processor.initXPath(xpath, str, null);
- processor.diagnoseXPath2(xpath, 0, 0);
- }
-
- public static void diagnoseXPathString3( String str )
- {
- XPathSupport callbacks = new XPathSupportDefault();
- XPathProcessorImpl processor = new XPathProcessorImpl(callbacks);
- XPath xpath = new XPath(callbacks);
- processor.initXPath(xpath, str, null);
- int len = xpath.m_opMap[xpath.MAPINDEX_LENGTH];
- for(int i = 0; i < len; i++)
- {
- System.out.println("["+xpath.m_opMap[i]+"]");
- }
- }
-
- private static void diagnoseNodeTest2(int opPos, String op)
- {
- System.out.print(m_nTestLabel+op+m_close);
- }
-
- private static void diagnoseOpNoLable2(int opPos, String op)
- {
- System.out.println(m_noLabel+op+m_close);
- }
-
- private static void diagnoseOpOnly2(int opPos, String op)
- {
- System.out.println(m_opLabel+op+m_close);
- }
-
- private static void diagnoseOp2(String op, XPath xpath, int opPos)
- {
- System.out.print(m_opLabel+op+m_close);
- int opLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH];
- System.out.println(m_open+opLen+m_close);
- }
-
- private static void diagnoseOp2SameLine(String op, XPath xpath, int opPos)
- {
- System.out.print(m_opLabel+op+m_close);
- int opLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH];
- System.out.print(m_open+opLen+m_close);
- }
-
- static int diagnoseXPathBinaryOperation2(String op, XPath xpath, int
opPos, int indent)
- {
- diagnoseOp2(op, xpath, opPos);
- opPos+=2;
-
- opPos = diagnoseXPath2(xpath, opPos, indent+1);
-
- opPos = diagnoseXPath2(xpath, opPos, indent+1);
-
- return opPos;
- }
-
- static int diagnoseXPathUnaryOperation2(String op, XPath xpath, int opPos,
int indent)
- {
- diagnoseOp2(op, xpath, opPos);
- opPos+=2;
- opPos = diagnoseXPath2(xpath, opPos, indent+1);
- return opPos;
- }
-
- static int diagnoseXPathMultiOperation2(String op, int multiOp, XPath
xpath, int opPos, int indent)
- {
- diagnoseOp2(op, xpath, opPos);
- opPos+=2;
- while(xpath.m_opMap[opPos] == multiOp)
- {
- opPos = diagnoseXPath2(xpath, opPos, indent+2);
- }
- return opPos;
- }
-
- static int diagnoseToken2(XPath xpath, int opPos)
- {
- int tokenPos = xpath.m_opMap[opPos];
- String token = (tokenPos >= 0) ?
xpath.m_tokenQueue[tokenPos].toString() :
-
(tokenPos == xpath.ELEMWILDCARD) ?
- "*" :
(tokenPos == xpath.EMPTY) ?
-
"EMPTY" : "UNKNOWN";
- System.out.println(m_noLabel+token+m_close);
- return opPos+1;
- }
-
- static int diagnoseToken2SameLine(XPath xpath, int opPos)
- {
-
System.out.print(m_noLabel+xpath.m_tokenQueue[xpath.m_opMap[opPos]]+m_close);
- return opPos+1;
- }
-
- static int diagnoseXPathSimpleOperation2(String op, XPath xpath, int
opPos, int indent)
- {
- diagnoseOp2SameLine(op, xpath, opPos);
- opPos+=2;
- opPos = diagnoseToken2(xpath, opPos);
- return opPos;
- }
-
- static int diagnoseXPathLocationStep2(String op, XPath xpath, int opPos,
int indent)
- {
- int opLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH];
- int stepLen = xpath.m_opMap[opPos+xpath.MAPINDEX_LENGTH+1];
- System.out.print(m_opLabel+op+m_close);
- System.out.print(m_open+opLen+m_close);
- System.out.print(m_open+stepLen+m_close);
- opPos+=3;
- if(stepLen > 3)
- {
- opPos = diagnoseXPath2(xpath, opPos, 0);
- }
- return opPos;
- }
-
- static int diagnoseXPath2(XPath xpath, int opPos, int indent)
- {
- indent(indent);
- switch(xpath.m_opMap[opPos])
- {
- case xpath.OP_XPATH:
- opPos = diagnoseXPathUnaryOperation2("OP_XPATH", xpath, opPos,
indent);
- break;
- case xpath.EMPTY:
- diagnoseOpOnly2(opPos, "EMPTY");
- opPos++;
- break;
- case xpath.OP_OR:
- opPos = diagnoseXPathBinaryOperation2("OP_OR", xpath, opPos, indent);
- break;
- case xpath.OP_AND:
- opPos = diagnoseXPathBinaryOperation2("OP_AND", xpath, opPos, indent);
- break;
- case xpath.OP_NOTEQUALS:
- opPos = diagnoseXPathBinaryOperation2("OP_NOTEQUALS", xpath, opPos,
indent);
- break;
- case xpath.OP_EQUALS:
- opPos = diagnoseXPathBinaryOperation2("OP_EQUALS", xpath, opPos,
indent);
- break;
- case xpath.OP_LTE:
- opPos = diagnoseXPathBinaryOperation2("OP_LTE", xpath, opPos, indent);
- break;
- case xpath.OP_LT:
- opPos = diagnoseXPathBinaryOperation2("OP_LT", xpath, opPos, indent);
- break;
- case xpath.OP_GTE:
- opPos = diagnoseXPathBinaryOperation2("OP_GTE", xpath, opPos, indent);
- break;
- case xpath.OP_GT:
- opPos = diagnoseXPathBinaryOperation2("OP_GT", xpath, opPos, indent);
- break;
- case xpath.OP_PLUS:
- opPos = diagnoseXPathBinaryOperation2("OP_PLUS", xpath, opPos,
indent);
- break;
- case xpath.OP_MINUS:
- opPos = diagnoseXPathBinaryOperation2("OP_MINUS", xpath, opPos,
indent);
- break;
- case xpath.OP_MULT:
- opPos = diagnoseXPathBinaryOperation2("OP_MULT", xpath, opPos,
indent);
- break;
- case xpath.OP_DIV:
- opPos = diagnoseXPathBinaryOperation2("OP_DIV", xpath, opPos, indent);
- break;
- case xpath.OP_MOD:
- opPos = diagnoseXPathBinaryOperation2("OP_MOD", xpath, opPos, indent);
- break;
- case xpath.OP_QUO:
- opPos = diagnoseXPathBinaryOperation2("OP_QUO", xpath, opPos, indent);
- break;
- case xpath.OP_NEG:
- opPos = diagnoseXPathUnaryOperation2("OP_NEG", xpath, opPos, indent);
- break;
- case xpath.OP_STRING:
- opPos = diagnoseXPathUnaryOperation2("OP_STRING", xpath, opPos,
indent);
- break;
- case xpath.OP_BOOL:
- opPos = diagnoseXPathUnaryOperation2("OP_BOOL", xpath, opPos, indent);
- break;
- case xpath.OP_NUMBER:
- opPos = diagnoseXPathUnaryOperation2("OP_NUMBER", xpath, opPos,
indent);
- break;
- case xpath.OP_UNION:
- opPos = diagnoseXPathMultiOperation2("OP_UNION",
xpath.OP_LOCATIONPATH, xpath, opPos, indent);
- break;
- case xpath.OP_LITERAL:
- opPos = diagnoseXPathSimpleOperation2("OP_LITERAL", xpath, opPos,
indent);
- break;
- case xpath.OP_VARIABLE:
- opPos = diagnoseXPathSimpleOperation2("OP_VARIABLE", xpath, opPos,
indent);
- break;
- case xpath.OP_GROUP:
- opPos = diagnoseXPathUnaryOperation2("OP_GROUP", xpath, opPos,
indent);
- break;
- case xpath.OP_NUMBERLIT:
- opPos = diagnoseXPathSimpleOperation2("OP_NUMBERLIT", xpath, opPos,
indent);
- break;
- case xpath.OP_ARGUMENT:
- opPos = diagnoseXPathUnaryOperation2("OP_ARGUMENT", xpath, opPos,
indent);
- break;
- case xpath.OP_EXTFUNCTION:
- {
- diagnoseOp2SameLine("OP_EXTFUNCTION", xpath, opPos);
- int endExtFunc = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- opPos = diagnoseToken2SameLine(xpath, opPos);
- opPos = diagnoseToken2(xpath, opPos);
- while(opPos < endExtFunc)
- {
- opPos = diagnoseXPath2(xpath, opPos, indent+2);
- }
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- indent(indent+1);
- diagnoseOpOnly2(opPos, "ENDOP");
- opPos++;
- }
- break;
- case xpath.OP_FUNCTION:
- {
- diagnoseOp2SameLine("OP_FUNCTION", xpath, opPos);
- int endFunc = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- int funcID = xpath.m_opMap[opPos];
- switch(funcID)
- {
- case xpath.FUNC_LAST: diagnoseOpNoLable2(opPos, "FUNC_LAST");
break;
- case xpath.FUNC_POSITION: diagnoseOpNoLable2(opPos,
"FUNC_POSITION"); break;
- case xpath.FUNC_COUNT: diagnoseOpNoLable2(opPos, "FUNC_COUNT");
break;
- case xpath.FUNC_ID: diagnoseOpNoLable2(opPos, "FUNC_ID"); break;
- case xpath.FUNC_KEY: diagnoseOpNoLable2(opPos, "FUNC_KEY");
break;
- case xpath.FUNC_DOC: diagnoseOpNoLable2(opPos, "FUNC_DOC");
break;
- case xpath.FUNC_LOCAL_PART: diagnoseOpNoLable2(opPos,
"FUNC_LOCAL_PART"); break;
- case xpath.FUNC_NAMESPACE: diagnoseOpNoLable2(opPos,
"FUNC_NAMESPACE"); break;
- case xpath.FUNC_QNAME: diagnoseOpNoLable2(opPos, "FUNC_QNAME");
break;
- case xpath.FUNC_GENERATE_ID: diagnoseOpNoLable2(opPos,
"FUNC_GENERATE_ID"); break;
- case xpath.FUNC_NOT: diagnoseOpNoLable2(opPos, "FUNC_NOT");
break;
- case xpath.FUNC_TRUE: diagnoseOpNoLable2(opPos, "FUNC_TRUE");
break;
- case xpath.FUNC_FALSE: diagnoseOpNoLable2(opPos, "FUNC_FALSE");
break;
- case xpath.FUNC_BOOLEAN: diagnoseOpNoLable2(opPos,
"FUNC_BOOLEAN"); break;
- case xpath.FUNC_LANG: diagnoseOpNoLable2(opPos, "FUNC_LANG");
break;
- case xpath.FUNC_NUMBER: diagnoseOpNoLable2(opPos,
"FUNC_NUMBER"); break;
- case xpath.FUNC_FLOOR: diagnoseOpNoLable2(opPos, "FUNC_FLOOR");
break;
- case xpath.FUNC_CEILING: diagnoseOpNoLable2(opPos,
"FUNC_CEILING"); break;
- case xpath.FUNC_ROUND: diagnoseOpNoLable2(opPos, "FUNC_ROUND");
break;
- case xpath.FUNC_SUM: diagnoseOpNoLable2(opPos, "FUNC_SUM");
break;
- case xpath.FUNC_STRING: diagnoseOpNoLable2(opPos,
"FUNC_STRING"); break;
- case xpath.FUNC_STARTS_WITH: diagnoseOpNoLable2(opPos,
"FUNC_STARTS_WITH"); break;
- case xpath.FUNC_CONTAINS: diagnoseOpNoLable2(opPos,
"FUNC_CONTAINS"); break;
- case xpath.FUNC_SUBSTRING_BEFORE: diagnoseOpNoLable2(opPos,
"FUNC_SUBSTRING_BEFORE"); break;
- case xpath.FUNC_SUBSTRING_AFTER: diagnoseOpNoLable2(opPos,
"FUNC_SUBSTRING_AFTER"); break;
- case xpath.FUNC_NORMALIZE: diagnoseOpNoLable2(opPos,
"FUNC_NORMALIZE"); break;
- case xpath.FUNC_TRANSLATE: diagnoseOpNoLable2(opPos,
"FUNC_TRANSLATE"); break;
- case xpath.FUNC_CONCAT: diagnoseOpNoLable2(opPos,
"FUNC_CONCAT"); break;
- case xpath.FUNC_FORMAT_NUMBER: diagnoseOpNoLable2(opPos,
"FUNC_FORMAT_NUMBER"); break;
- case xpath.FUNC_SYSTEM_PROPERTY: diagnoseOpNoLable2(opPos,
"FUNC_SYSTEM_PROPERTY"); break;
- case xpath.FUNC_EXT_FUNCTION_AVAILABLE:
diagnoseOpNoLable2(opPos, "FUNC_EXT_FUNCTION_AVAILABLE"); break;
- case xpath.FUNC_EXT_ELEM_AVAILABLE: diagnoseOpNoLable2(opPos,
"FUNC_EXT_ELEM_AVAILABLE"); break;
- case xpath.FUNC_SUBSTRING: diagnoseOpNoLable2(opPos,
"FUNC_SUBSTRING"); break;
- case xpath.FUNC_STRING_LENGTH: diagnoseOpNoLable2(opPos,
"FUNC_STRING_LENGTH"); break;
- case xpath.FUNC_DOCLOCATION: diagnoseOpNoLable2(opPos,
"FUNC_DOCLOCATION"); break;
- }
- opPos++;
- while(opPos < endFunc)
- {
- // indent(indent+1);
- opPos = diagnoseXPath2(xpath, opPos, indent+2);
- }
- indent(indent);
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- indent(indent+1);
- diagnoseOpOnly2(opPos, "ENDOP");
- opPos++;
- }
- break;
- case xpath.OP_LOCATIONPATH:
- diagnoseOp2("OP_LOCATIONPATH", xpath, opPos);
- int endPath = opPos+xpath.m_opMap[opPos+1]-1;
- opPos+=2;
- while(opPos < endPath)
- {
- opPos = diagnoseXPath2(xpath, opPos, indent+1);
- }
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- indent(indent+1);
- diagnoseOpOnly2(opPos, "ENDOP");
- opPos++;
- break;
- case xpath.OP_PREDICATE:
- indent(1);
- opPos = diagnoseXPathUnaryOperation2("OP_PREDICATE", xpath, opPos,
indent+1);
- if(xpath.m_opMap[opPos] != xpath.ENDOP)
- {
- System.out.println("ERROR! Could not find ENDOP after
OP_LOCATIONPATH");
- }
- indent(indent+2);
- diagnoseOpOnly2(opPos, "ENDOP");
- opPos++;
- break;
- case xpath.FROM_ANCESTORS:
- opPos = diagnoseXPathLocationStep2("FROM_ANCESTORS", xpath, opPos, 1);
- break;
- case xpath.FROM_ANCESTORS_OR_SELF:
- opPos = diagnoseXPathLocationStep2("FROM_ANCESTORS_OR_SELF", xpath,
opPos, 1);
- break;
- case xpath.FROM_ATTRIBUTES:
- opPos = diagnoseXPathLocationStep2("FROM_ATTRIBUTES", xpath, opPos,
1);
- break;
- case xpath.FROM_CHILDREN:
- opPos = diagnoseXPathLocationStep2("FROM_CHILDREN", xpath, opPos, 1);
- break;
- case xpath.FROM_DESCENDANTS:
- opPos = diagnoseXPathLocationStep2("FROM_DESCENDANTS", xpath, opPos,
1);
- break;
- case xpath.FROM_DESCENDANTS_OR_SELF:
- opPos = diagnoseXPathLocationStep2("FROM_DESCENDANTS_OR_SELF", xpath,
opPos, 1);
- break;
- case xpath.FROM_FOLLOWING:
- opPos = diagnoseXPathLocationStep2("FROM_FOLLOWING", xpath, opPos,
indent);
- break;
- case xpath.FROM_FOLLOWING_SIBLINGS:
- opPos = diagnoseXPathLocationStep2("FROM_FOLLOWING_SIBLINGS", xpath,
opPos, indent);
- break;
- case xpath.FROM_PARENT:
- opPos = diagnoseXPathLocationStep2("FROM_PARENT", xpath, opPos,
indent);
- break;
- case xpath.FROM_PRECEDING:
- opPos = diagnoseXPathLocationStep2("FROM_PRECEDING", xpath, opPos,
indent);
- break;
- case xpath.FROM_PRECEDING_SIBLINGS:
- opPos = diagnoseXPathLocationStep2("FROM_PRECEDING_SIBLINGS", xpath,
opPos, indent);
- break;
- case xpath.FROM_SELF:
- opPos = diagnoseXPathLocationStep2("FROM_SELF", xpath, opPos, indent);
- break;
- case xpath.FROM_NAMESPACE:
- opPos = diagnoseXPathLocationStep2("FROM_NAMESPACE", xpath, opPos,
indent);
- break;
- // case xpath.FROM_ATTRIBUTE:
- // opPos = diagnoseXPathLocationStep("FROM_ATTRIBUTE", xpath,
opPos, indent);
- // break;
- // case xpath.FROM_DOC:
- // opPos = diagnoseXPathLocationStep("FROM_DOC", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_DOCREF:
- // opPos = diagnoseXPathLocationStep("FROM_DOCREF", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_ID:
- // opPos = diagnoseXPathLocationStep("FROM_ID", xpath, opPos,
indent);
- // break;
- // case xpath.FROM_IDREF:
- // opPos = diagnoseXPathLocationStep("FROM_IDREF", xpath, opPos,
indent);
- // break;
- case xpath.FROM_ROOT:
- opPos = diagnoseXPathLocationStep2("FROM_ROOT", xpath, opPos, indent);
- // opPos++;
- break;
- case xpath.NODETYPE_COMMENT:
- diagnoseNodeTest2(opPos, "NODETYPE_COMMENT");
- System.out.println();
- opPos++;
- break;
- case xpath.NODETYPE_TEXT:
- diagnoseNodeTest2(opPos, "NODETYPE_TEXT");
- System.out.println();
- opPos++;
- break;
- case xpath.NODETYPE_PI:
- int piLen = xpath.m_opMap[opPos-1];
- diagnoseNodeTest2(opPos, "NODETYPE_PI");
- opPos++;
- if(piLen > 3)
- {
- opPos = diagnoseToken(xpath, opPos);
- }
- break;
- case xpath.NODETYPE_NODE:
- diagnoseNodeTest2(opPos, "NODETYPE_NODE");
- System.out.println();
- opPos++;
- break;
- case xpath.NODETYPE_ROOT:
- diagnoseNodeTest2(opPos, "NODETYPE_ROOT");
- System.out.println();
- opPos++;
- break;
- case xpath.NODETYPE_ANYELEMENT:
- diagnoseNodeTest2(opPos, "NODETYPE_ANYELEMENT");
- System.out.println();
- opPos++;
- break;
- case xpath.NODENAME:
- diagnoseNodeTest2(opPos, "NODENAME");
- opPos++;
- if(xpath.m_opMap[opPos] < 0)
- {
- System.out.print(m_noLabel+"EMPTY"+m_close);
- opPos++;
- }
- else
- {
- opPos = diagnoseToken2(xpath, opPos);
- }
- opPos = diagnoseToken2(xpath, opPos);
- break;
- default:
- System.out.println("ERROR! Unknown op code: "+xpath.m_opMap[opPos]);
- }
- return opPos;
- }
-#endif
+ isValidFunction(const XalanDOMString& key) const;
private:
@@ -1713,14 +753,14 @@
/**
* The current input token.
*/
- DOMString m_token;
+ XalanDOMString m_token;
/**
* The first char in m_token, the theory being that this
* is an optimization because we won't have to do charAt(0) as
* often.
*/
- XMLCh m_tokenChar;
+ XalanDOMChar m_tokenChar;
/**
* A pointer to the current XPath.
1.6 +35 -22 xml-xalan/c/src/XPath/XPathSupport.hpp
Index: XPathSupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupport.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XPathSupport.hpp 2000/03/06 17:17:51 1.5
+++ XPathSupport.hpp 2000/04/11 14:46:22 1.6
@@ -64,10 +64,7 @@
-#include <dom/DOMString.hpp>
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_Document.hpp>
-#include <dom/DOM_Element.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -77,6 +74,10 @@
class DocumentHandler;
class XMLURL;
+class XalanDocument;
+class XalanElement;
+class XalanNode;
+class XalanText;
@@ -97,7 +98,7 @@
* @return true if white space can be ignored
*/
virtual bool
- isIgnorableWhitespace(const DOM_Text& node) const = 0;
+ isIgnorableWhitespace(const XalanText& node) const = 0;
/**
* Retrieve the URI corresponding to a namespace prefix
@@ -106,10 +107,10 @@
* @param namespaceContext DOM element representing the context for
namespace
* @return URI corresponding to namespace
*/
- virtual DOMString
+ virtual XalanDOMString
getNamespaceForPrefix(
- const DOMString& prefix,
- const DOM_Element& namespaceContext) const = 0;
+ const XalanDOMString& prefix,
+ const XalanElement& namespaceContext) const
= 0;
/**
* Returns the namespace of the given node.
@@ -117,8 +118,8 @@
* @param node DOM node whose namespace is returned
* @return namespace of node
*/
- virtual DOMString
- getNamespaceOfNode(const DOM_Node& n) const = 0;
+ virtual XalanDOMString
+ getNamespaceOfNode(const XalanNode& n) const = 0;
/**
* Retrieve local name of node
@@ -126,8 +127,8 @@
* @param node DOM node whose name is returned
* @return name of node without namespace
*/
- virtual DOMString
- getLocalNameOfNode(const DOM_Node& n) const = 0;
+ virtual XalanDOMString
+ getLocalNameOfNode(const XalanNode& n) const = 0;
/**
* Retrieves data for node recursively.
@@ -138,8 +139,8 @@
* @return a string representation of the node's data
*/
- virtual DOMString
- getNodeData(const DOM_Node& n) const = 0;
+ virtual XalanDOMString
+ getNodeData(const XalanNode& n) const = 0;
/**
* Retrieve the parent of a node. This function has to be implemented,
@@ -148,20 +149,32 @@
* @param node child node
* @return parent node
*/
- virtual DOM_Node
- getParentOfNode(const DOM_Node& n) const = 0;
+ virtual XalanNode*
+ getParentOfNode(const XalanNode& n) const = 0;
/**
+ * Determine if a node is after another node, in document order.
+ *
+ * @param node1 The first node
+ * @param node2 The second node
+ * @return true if node1 one is after node2, or false if it is not.
+ */
+ virtual bool
+ isNodeAfter(
+ const XalanNode& node1,
+ const XalanNode& node2) const = 0;
+
+ /**
* Given a valid element id, return the corresponding element.
*
* @param id string representing ID
* @param doc document to search
* @return element for ID
*/
- virtual DOM_Element
+ virtual XalanElement*
getElementByID(
- const DOMString& id,
- const DOM_Document& doc) const = 0;
+ const XalanDOMString& id,
+ const XalanDocument& doc) const = 0;
/**
* Set whether or not the liaison attempts to expand namespaces.
Used
@@ -194,10 +207,10 @@
// completely expand entities before the structure model is passed to
the
// DOM; in this case, there will be no EntityReferences in the DOM
tree."
// So I'm not sure how well this is going to work.
- virtual DOMString
+ virtual XalanDOMString
getUnparsedEntityURI(
- const DOMString& theName,
- const DOM_Document& theDocument) const = 0;
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const = 0;
// These interfaces are inherited from Resettable...
1.5 +51 -48 xml-xalan/c/src/XPath/XPathSupportDefault.cpp
Index: XPathSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupportDefault.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathSupportDefault.cpp 2000/02/17 20:29:53 1.4
+++ XPathSupportDefault.cpp 2000/04/11 14:46:22 1.5
@@ -62,12 +62,12 @@
-#include <dom/DOM_NamedNodeMap.hpp>
-#include <dom/DOM_Entity.hpp>
+#include <XalanDOM/XalanDocument.hpp>
+#include <XalanDOM/XalanDocumentType.hpp>
+#include <XalanDOM/XalanElement.hpp>
+#include <XalanDOM/XalanEntity.hpp>
+#include <XalanDOM/XalanNamedNodeMap.hpp>
-// $$$ ToDo: Eventually, we shouldn't have to do this, but we need ignorable
-// whitespace support
-#include <internal/XMLReader.hpp>
#include <PlatformSupport/DOMStringHelper.hpp>
@@ -80,8 +80,8 @@
XPathSupportDefault::XPathSupportDefault(DOMSupport& theDOMSupport) :
XPathSupport(),
- DOMServices::WhitespaceSupport(),
- m_DOMSupport(theDOMSupport)
+ m_DOMSupport(theDOMSupport),
+ m_whitespaceSupport()
{
}
@@ -101,10 +101,18 @@
-DOMString
+bool
+XPathSupportDefault::isIgnorableWhitespace(const XalanText& node)
const
+{
+ return m_whitespaceSupport.isIgnorableWhitespace(node);
+}
+
+
+
+XalanDOMString
XPathSupportDefault::getNamespaceForPrefix(
- const DOMString& prefix,
- const DOM_Element& namespaceContext) const
+ const XalanDOMString& prefix,
+ const XalanElement& namespaceContext) const
{
return DOMServices::getNamespaceForPrefix(prefix,
namespaceContext);
@@ -112,39 +120,33 @@
-DOMString
-XPathSupportDefault::getNamespaceOfNode(const DOM_Node& n) const
+XalanDOMString
+XPathSupportDefault::getNamespaceOfNode(const XalanNode& n) const
{
return m_DOMSupport.getNamespaceOfNode(n);
}
-DOMString
-XPathSupportDefault::getLocalNameOfNode(const DOM_Node& n) const
+XalanDOMString
+XPathSupportDefault::getLocalNameOfNode(const XalanNode& n) const
{
return DOMServices::getLocalNameOfNode(n);
}
-DOMString
-XPathSupportDefault::getNodeData(const DOM_Node& node) const
+XalanDOMString
+XPathSupportDefault::getNodeData(const XalanNode& node) const
{
return DOMServices::getNodeData(node,
- *this);
+
m_whitespaceSupport);
}
-/**
- * I have to write this silly, and expensive function,
- * because the DOM WG decided that attributes don't
- * have parents. If XPath is used with a DOM implementation
- * that reuses attribute nodes, this will not work correctly.
- */
-DOM_Node
-XPathSupportDefault::getParentOfNode(const DOM_Node& node) const
+XalanNode*
+XPathSupportDefault::getParentOfNode(const XalanNode& node) const
{
return DOMServices::getParentOfNode(node);
}
@@ -152,23 +154,21 @@
bool
-XPathSupportDefault::isIgnorableWhitespace(const DOM_Text& node) const
+XPathSupportDefault::isNodeAfter(
+ const XalanNode& node1,
+ const XalanNode& node2) const
{
-// $$$ ToDo: Eventually, we shouldn't have to do this, but we need ignorable
-// whitespace support
- const DOMString theData(node.getData());
-
- return XMLReader::isAllSpaces(toCharArray(theData), length(theData));
+ return DOMServices::isNodeAfter(node1, node2);
}
-DOM_Element
+XalanElement*
XPathSupportDefault::getElementByID(
- const DOMString& /* id */,
- const DOM_Document& /* doc */) const
+ const XalanDOMString& /* id */,
+ const XalanDocument& /* doc */) const
{
- return DOM_Element();
+ return 0;
}
@@ -188,29 +188,32 @@
-DOMString
+XalanDOMString
XPathSupportDefault::getUnparsedEntityURI(
- const DOMString& theName,
- const DOM_Document& theDocument) const
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const
{
- DOMString theURI;
+ XalanDOMString theURI;
- const DOM_DocumentType theDoctype = theDocument.getDoctype();
+ const XalanDocumentType* const theDoctype =
+ theDocument.getDoctype();
if(theDoctype != 0)
{
- DOM_NamedNodeMap theEntities = theDoctype.getEntities();
+ const XalanNamedNodeMap* const theEntities =
+ theDoctype->getEntities();
if (theEntities != 0)
{
- const DOM_Node theNode =
theEntities.getNamedItem(theName);
+ const XalanNode* const theNode =
+ theEntities->getNamedItem(theName);
- if (theNode != 0 && theNode.getNodeType() ==
DOM_Node::ENTITY_NODE)
+ if (theNode != 0 && theNode->getNodeType() ==
XalanNode::ENTITY_NODE)
{
- const DOM_Entity& theEntity =
- static_cast<const DOM_Entity&>(theNode);
+ const XalanEntity* theEntity =
+ static_cast<const
XalanEntity*>(theNode);
- const DOMString theNotationName =
theEntity.getNotationName();
+ const XalanDOMString
theNotationName(theEntity->getNotationName());
if(isEmpty(theNotationName) == false) // then
it's unparsed
{
@@ -223,11 +226,11 @@
// the resource containing the entity
declaration as the base
// URI [RFC2396]."
// So I'm falling a bit short here.
- theURI = theEntity.getSystemId();
+ theURI = theEntity->getSystemId();
if(isEmpty(theURI) == true)
{
- theURI =
theEntity.getPublicId();
+ theURI =
theEntity->getPublicId();
}
else
{
1.5 +29 -24 xml-xalan/c/src/XPath/XPathSupportDefault.hpp
Index: XPathSupportDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathSupportDefault.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathSupportDefault.hpp 2000/03/06 17:17:51 1.4
+++ XPathSupportDefault.hpp 2000/04/11 14:46:22 1.5
@@ -73,7 +73,7 @@
-class XALAN_XPATH_EXPORT XPathSupportDefault : public XPathSupport, public
DOMServices::WhitespaceSupport
+class XALAN_XPATH_EXPORT XPathSupportDefault : public XPathSupport
{
public:
@@ -83,35 +83,37 @@
~XPathSupportDefault();
- // These interfaces are inherited from DOMServices::WhitespaceSupport...
+ // These intefaces are inherited from XPathSupport...
virtual bool
- isIgnorableWhitespace(const DOM_Text& node) const;
-
-
- // These intefaces are inherited from XPathSupport...
+ isIgnorableWhitespace(const XalanText& node) const;
- virtual DOMString
+ virtual XalanDOMString
getNamespaceForPrefix(
- const DOMString& prefix,
- const DOM_Element& namespaceContext) const;
+ const XalanDOMString& prefix,
+ const XalanElement& namespaceContext) const;
- virtual DOMString
- getNamespaceOfNode(const DOM_Node& n) const;
+ virtual XalanDOMString
+ getNamespaceOfNode(const XalanNode& n) const;
- virtual DOMString
- getLocalNameOfNode(const DOM_Node& n) const;
+ virtual XalanDOMString
+ getLocalNameOfNode(const XalanNode& n) const;
- virtual DOMString
- getNodeData(const DOM_Node& n) const;
+ virtual XalanDOMString
+ getNodeData(const XalanNode& n) const;
- virtual DOM_Node
- getParentOfNode(const DOM_Node& node) const;
+ virtual XalanNode*
+ getParentOfNode(const XalanNode& node) const;
- virtual DOM_Element
+ virtual bool
+ isNodeAfter(
+ const XalanNode& node1,
+ const XalanNode& node2) const;
+
+ virtual XalanElement*
getElementByID(
- const DOMString& id,
- const DOM_Document& doc) const;
+ const XalanDOMString& id,
+ const XalanDocument& doc) const;
virtual void
setProcessNamespaces(bool processNamespaces);
@@ -119,10 +121,10 @@
virtual bool
getProcessNamespaces() const;
- virtual DOMString
+ virtual XalanDOMString
getUnparsedEntityURI(
- const DOMString& theName,
- const DOM_Document& theDocument) const;
+ const XalanDOMString& theName,
+ const XalanDocument& theDocument) const;
// These interfaces are inherited from Resettable...
@@ -142,7 +144,10 @@
operator==(const XPathSupportDefault&);
// Data members...
- DOMSupport& m_DOMSupport;
+
+ DOMSupport&
m_DOMSupport;
+
+ DOMServices::WhitespaceSupportDefault m_whitespaceSupport;
};
1.3 +6 -17 xml-xalan/c/src/XPath/XPointer.cpp
Index: XPointer.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPointer.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPointer.cpp 2000/01/26 20:34:43 1.2
+++ XPointer.cpp 2000/04/11 14:46:22 1.3
@@ -58,35 +58,24 @@
-#include <iostream>
+#include "XPathException.hpp"
XSpan*
-XPointer::getNode(const DOMString& /* xpointer */)
+XPointer::getNode(const XalanDOMString& /* xpointer */)
{
-#if !defined(XALAN_NO_NAMESPACES)
- using namespace std;
-#endif
+ throw XPathException("Error! XPointer::getNode not yet implemented!");
- cerr << "Error! XPointer.getNode not yet implemented!"
- << endl;
-
return 0;
}
+
- /**
- * Get a span from an XPath (compiled XPointer) object.
- */
+
XSpan*
XPointer::getNode(XPath& /* xpath */)
{
-#if !defined(XALAN_NO_NAMESPACES)
- using namespace std;
-#endif
-
- cerr << "Error! XPointer.getNode not yet implemented!"
- << endl;
+ throw XPathException("Error! XPointer::getNode not yet implemented!");
return 0;
}
1.3 +6 -2 xml-xalan/c/src/XPath/XPointer.hpp
Index: XPointer.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPointer.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPointer.hpp 2000/03/06 17:17:51 1.2
+++ XPointer.hpp 2000/04/11 14:46:22 1.3
@@ -64,7 +64,11 @@
-class DOMString;
+// $$$ ToDo: This is necessary while XalanDOMString is still a typedef...
+#include <XalanDOM/XalanDOMString.hpp>
+
+
+
class XPath;
class XSpan;
@@ -80,7 +84,7 @@
* @param xpointer XPointer string
*/
static XSpan*
- getNode(const DOMString& xpointer);
+ getNode(const XalanDOMString& xpointer);
/**
* Get a span from an XPath (compiled XPointer) object.
1.2 +90 -20 xml-xalan/c/src/XPath/XResultTreeFrag.cpp
Index: XResultTreeFrag.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XResultTreeFrag.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XResultTreeFrag.cpp 1999/12/18 19:47:55 1.1
+++ XResultTreeFrag.cpp 2000/04/11 14:46:23 1.2
@@ -59,9 +59,8 @@
-#include <dom/DOM_Node.hpp>
-#include <dom/DOM_NodeList.hpp>
-#include <dom/DOM_Text.hpp>
+#include <XalanDOM/XalanNodeList.hpp>
+#include <XalanDOM/XalanText.hpp>
@@ -82,6 +81,7 @@
const ResultTreeFragBase& val,
bool
deepClone) :
XObject(&envSupport),
+ NodeRefListBase(),
m_support(support),
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
m_value(dynamic_cast<ResultTreeFragBase*>(val.clone(deepClone)))
@@ -97,6 +97,7 @@
const XResultTreeFrag& source,
bool deepClone) :
XObject(source),
+ NodeRefListBase(source),
m_support(source.m_support),
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
m_value(dynamic_cast<ResultTreeFragBase*>(source.m_value->clone(deepClone)))
@@ -122,10 +123,10 @@
-DOMString
+XalanDOMString
XResultTreeFrag::getTypeString() const
{
- return "#RESULT_TREE_FRAG";
+ return XALAN_STATIC_UCODE_STRING("#RESULT_TREE_FRAG");
}
@@ -133,7 +134,7 @@
double
XResultTreeFrag::num() const
{
- const DOMString theValue =
m_support.getNodeData(DOM_ResultTreeFragBase(m_value.get()));
+ const XalanDOMString theValue =
m_support.getNodeData(*m_value.get());
return DOMStringToDouble(theValue);
}
@@ -145,21 +146,17 @@
{
bool fResult = false;
- const NodeRefListBase& nl = m_value->getChildNodesAsNodeRefList();
+ const XalanNode* theCurrentNode = m_value->getFirstChild();
- const int nChildren = nl.getLength();
-
- for(int i = 0; i < nChildren; i++)
+ while(theCurrentNode != 0)
{
- const DOM_Node n = nl.item(i);
-
- if(DOM_Node::TEXT_NODE == n.getNodeType())
+ if(XalanNode::TEXT_NODE == theCurrentNode->getNodeType())
{
- const DOM_Text& theTextNode =
- static_cast<const DOM_Text&>(n);
+ const XalanText* const theTextNode =
+ static_cast<const XalanText*>(theCurrentNode);
- if (m_support.isIgnorableWhitespace(theTextNode) ||
- length(trim(theTextNode.getData())) == 0)
+ if (m_support.isIgnorableWhitespace(*theTextNode) ||
+ length(trim(theTextNode->getData())) == 0)
{
continue;
}
@@ -167,6 +164,8 @@
fResult = true;
break;
}
+
+ theCurrentNode = theCurrentNode->getNextSibling();
}
return fResult;
@@ -174,10 +173,10 @@
-DOMString
+XalanDOMString
XResultTreeFrag::str() const
{
- return m_support.getNodeData(DOM_ResultTreeFragBase(m_value.get()));
+ return m_support.getNodeData(*m_value.get());
}
@@ -201,7 +200,7 @@
const NodeRefListBase&
XResultTreeFrag::nodeset() const
{
- return m_value->getChildNodesAsNodeRefList();
+ return *this;
}
@@ -252,4 +251,75 @@
XResultTreeFrag::equals(const XObject& theRHS) const
{
return ::equals(str(), theRHS.str());
+}
+
+
+
+XalanNode*
+XResultTreeFrag::item(unsigned int index) const
+{
+ assert(m_value.get() != 0);
+
+ XalanNode* theCurrentChild = m_value->getFirstChild();
+
+ for(unsigned int i = 0; i < index && theCurrentChild != 0; ++i)
+ {
+ theCurrentChild = theCurrentChild->getNextSibling();
+ }
+
+ return theCurrentChild;
+}
+
+
+
+unsigned int
+XResultTreeFrag::getLength() const
+{
+ assert(m_value.get() != 0);
+
+ unsigned int theLength = 0;
+
+ XalanNode* theCurrentChild = m_value->getFirstChild();
+
+ while(theCurrentChild != 0)
+ {
+ ++theLength;
+ theCurrentChild = theCurrentChild->getNextSibling();
+ }
+
+ return theLength;
+}
+
+
+
+unsigned int
+XResultTreeFrag::indexOf(const XalanNode* theNode) const
+{
+ unsigned theIndex = 0;
+ bool fFound = false;
+
+ XalanNode* theCurrentChild = m_value->getFirstChild();
+
+ while(theCurrentChild != 0 && fFound == false)
+ {
+ if (theCurrentChild == theNode)
+ {
+ fFound = true;
+ }
+ else
+ {
+ theIndex++;
+ theCurrentChild = theCurrentChild->getNextSibling();
+ }
+ }
+
+ return fFound == true ? theIndex : NodeRefListBase::npos;
+}
+
+
+
+XPathSupport*
+XResultTreeFrag::getSupport() const
+{
+ return &m_support;
}
1.3 +19 -4 xml-xalan/c/src/XPath/XResultTreeFrag.hpp
Index: XResultTreeFrag.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XResultTreeFrag.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XResultTreeFrag.hpp 2000/03/06 17:17:52 1.2
+++ XResultTreeFrag.hpp 2000/04/11 14:46:23 1.3
@@ -70,10 +70,11 @@
// Base class header file.
#include <XPath/XObject.hpp>
+#include <XPath/NodeRefListBase.hpp>
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -81,7 +82,7 @@
-class XALAN_XPATH_EXPORT XResultTreeFrag : public XObject
+class XALAN_XPATH_EXPORT XResultTreeFrag : public XObject, private
NodeRefListBase
{
public:
@@ -117,7 +118,7 @@
virtual eObjectType
getType() const;
- virtual DOMString
+ virtual XalanDOMString
getTypeString() const;
virtual double
@@ -126,7 +127,7 @@
virtual bool
boolean() const;
- virtual DOMString
+ virtual XalanDOMString
str() const;
virtual const ResultTreeFragBase&
@@ -154,6 +155,20 @@
equals(const XObject& theRHS) const;
private:
+
+ // These methods are inherited from NodeRefListBase...
+
+ virtual XalanNode*
+ item(unsigned int index) const;
+
+ virtual unsigned int
+ getLength() const;
+
+ virtual unsigned int
+ indexOf(const XalanNode* theNode) const;
+
+ virtual XPathSupport*
+ getSupport() const;
XPathSupport& m_support;
1.2 +1 -1 xml-xalan/c/src/XPath/XSpan.cpp
Index: XSpan.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XSpan.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSpan.cpp 1999/12/18 19:47:55 1.1
+++ XSpan.cpp 2000/04/11 14:46:23 1.2
@@ -89,7 +89,7 @@
XSpan::XSpan(
XPathEnvSupport& envSupport,
XPathSupport& support,
- const DOM_Node& value) :
+ XalanNode& value) :
XNodeSet(envSupport,
support,
value),
1.3 +1 -1 xml-xalan/c/src/XPath/XSpan.hpp
Index: XSpan.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XSpan.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSpan.hpp 2000/03/06 17:17:52 1.2
+++ XSpan.hpp 2000/04/11 14:46:23 1.3
@@ -107,7 +107,7 @@
XSpan(
XPathEnvSupport& envSupport,
XPathSupport& support,
- const DOM_Node& value);
+ XalanNode& value);
XSpan(const XSpan& source);
1.2 +26 -12 xml-xalan/c/src/XPath/XString.cpp
Index: XString.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XString.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XString.cpp 1999/12/18 19:47:55 1.1
+++ XString.cpp 2000/04/11 14:46:23 1.2
@@ -59,6 +59,10 @@
+#include <XalanDOM/XalanText.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
@@ -71,9 +75,9 @@
XString::XString(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- const DOMString& val) :
+ XPathEnvSupport& envSupport,
+ XPathSupport& support,
+ const XalanDOMString& val) :
XObject(&envSupport),
m_support(support),
m_value(val),
@@ -115,10 +119,10 @@
-DOMString
+XalanDOMString
XString::getTypeString() const
{
- return "#STRING";
+ return XALAN_STATIC_UCODE_STRING("#STRING");
}
@@ -139,7 +143,7 @@
-DOMString
+XalanDOMString
XString::str() const
{
return m_value;
@@ -154,8 +158,12 @@
if (m_resultTreeFrag.get() == 0)
{
+ XalanDocument* const theFactory =
+ m_envSupport->getDOMFactory();
+ assert(theFactory != 0);
+
ResultTreeFrag* const theFrag =
- new ResultTreeFrag(m_envSupport->getDOMFactory(),
+ new ResultTreeFrag(*theFactory,
m_support);
#if defined(XALAN_OLD_AUTO_PTR)
@@ -164,8 +172,9 @@
m_resultTreeFrag.reset(theFrag);
#endif
- const DOM_Node textNode =
- m_envSupport->getDOMFactory().createTextNode(str());
+ XalanNode* const textNode =
+ theFactory->createTextNode(str());
+ assert(textNode != 0);
theFrag->appendChild(textNode);
}
@@ -180,8 +189,12 @@
{
if (m_resultTreeFrag.get() == 0)
{
+ XalanDocument* const theFactory =
+ m_envSupport->getDOMFactory();
+ assert(theFactory != 0);
+
ResultTreeFrag* const theFrag =
- new ResultTreeFrag(m_envSupport->getDOMFactory(),
+ new ResultTreeFrag(*theFactory,
m_support);
#if defined(XALAN_OLD_AUTO_PTR)
@@ -190,8 +203,9 @@
m_resultTreeFrag.reset(theFrag);
#endif
- const DOM_Node textNode =
- m_envSupport->getDOMFactory().createTextNode(str());
+ XalanNode* const textNode =
+ theFactory->createTextNode(str());
+ assert(textNode != 0);
theFrag->appendChild(textNode);
}
1.3 +7 -7 xml-xalan/c/src/XPath/XString.hpp
Index: XString.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XString.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XString.hpp 2000/03/06 17:17:53 1.2
+++ XString.hpp 2000/04/11 14:46:24 1.3
@@ -69,7 +69,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -95,9 +95,9 @@
* @param value source string
*/
XString(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- const DOMString& val);
+ XPathEnvSupport& envSupport,
+ XPathSupport& support,
+ const XalanDOMString& val);
XString(const XString& source);
@@ -110,7 +110,7 @@
virtual eObjectType
getType() const;
- virtual DOMString
+ virtual XalanDOMString
getTypeString() const;
virtual double
@@ -119,7 +119,7 @@
virtual bool
boolean() const;
- virtual DOMString
+ virtual XalanDOMString
str() const;
virtual const ResultTreeFragBase&
@@ -150,7 +150,7 @@
XPathSupport&
m_support;
- const DOMString
m_value;
+ const XalanDOMString m_value;
mutable std::auto_ptr<ResultTreeFragBase> m_resultTreeFrag;
};
1.2 +6 -6 xml-xalan/c/src/XPath/XUnknown.cpp
Index: XUnknown.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XUnknown.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XUnknown.cpp 1999/12/18 19:47:56 1.1
+++ XUnknown.cpp 2000/04/11 14:46:24 1.2
@@ -68,8 +68,8 @@
XUnknown::XUnknown(
- XPathEnvSupport& envSupport,
- const DOMString& name) :
+ XPathEnvSupport& envSupport,
+ const XalanDOMString& name) :
XObject(&envSupport),
m_name(name)
{
@@ -99,10 +99,10 @@
-DOMString
+XalanDOMString
XUnknown::getTypeString() const
{
- return "#UNKNOWN";
+ return XALAN_STATIC_UCODE_STRING("#UNKNOWN");
}
@@ -123,10 +123,10 @@
-DOMString
+XalanDOMString
XUnknown::str() const
{
- return DOMString("Unknown variable: ") + m_name;
+ return XalanDOMString(XALAN_STATIC_UCODE_STRING("Unknown variable: "))
+ m_name;
}
1.3 +6 -6 xml-xalan/c/src/XPath/XUnknown.hpp
Index: XUnknown.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XUnknown.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XUnknown.hpp 2000/03/06 17:17:53 1.2
+++ XUnknown.hpp 2000/04/11 14:46:24 1.3
@@ -64,7 +64,7 @@
-#include <dom/DOMString.hpp>
+#include <XalanDOM/XalanDOMString.hpp>
@@ -84,8 +84,8 @@
* @param name source string
*/
XUnknown(
- XPathEnvSupport& envSupport,
- const DOMString& name);
+ XPathEnvSupport& envSupport,
+ const XalanDOMString& name);
XUnknown(const XUnknown& source);
@@ -97,7 +97,7 @@
virtual eObjectType
getType() const;
- virtual DOMString
+ virtual XalanDOMString
getTypeString() const;
virtual double
@@ -106,7 +106,7 @@
virtual bool
boolean() const;
- virtual DOMString
+ virtual XalanDOMString
str() const;
virtual const ResultTreeFragBase&
@@ -135,7 +135,7 @@
private:
- const DOMString m_name;
+ const XalanDOMString m_name;
};