You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/06/06 18:54:28 UTC

cvs commit: xml-xalan/c/src/XPath SimpleNodeLocator.cpp

dbertoni    00/06/06 09:54:27

  Modified:    c/src/XPath SimpleNodeLocator.cpp
  Log:
  Fixed bug where attribute nodes were matching when they shouldn't.
  
  Revision  Changes    Path
  1.13      +20 -10    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SimpleNodeLocator.cpp	2000/05/26 19:20:39	1.12
  +++ SimpleNodeLocator.cpp	2000/06/06 16:54:26	1.13
  @@ -400,7 +400,7 @@
   
   
   XalanNode*
  -SimpleNodeLocator:: stepPattern(
  +SimpleNodeLocator::stepPattern(
   			const XPath&			xpath,
   			XPathExecutionContext&	executionContext,
   			XalanNode*				context, 
  @@ -529,18 +529,21 @@
   			argLen =
   				currentExpression.getOpCodeMapValue(opPos + XPathExpression::s__opCodeMapLengthIndex + 1) - 3;
   
  -			opPos += 3;
  -
   			score = xpath.s_MatchScoreNone;
   
  -			while(0 != localContext)
  +			if(localContext->getNodeType() != XalanNode::ATTRIBUTE_NODE)
   			{
  -				score = nodeTest(xpath, executionContext, localContext, opPos, argLen, stepType);
  +				opPos += 3;
   
  -				if(xpath.s_MatchScoreNone != score)
  -					break;
  +				while(0 != localContext)
  +				{
  +					score = nodeTest(xpath, executionContext, localContext, opPos, argLen, stepType);
  +
  +					if(xpath.s_MatchScoreNone != score)
  +						break;
   
  -				localContext = executionContext.getParentOfNode(*localContext);
  +					localContext = localContext->getParentNode();
  +				}
   			}
   		}
   		break;
  @@ -551,9 +554,16 @@
   		argLen =
   				currentExpression.getOpCodeMapValue(opPos + XPathExpression::s__opCodeMapLengthIndex + 1) - 3;
   
  -		opPos += 3;
  +		if(localContext->getNodeType() == XalanNode::ATTRIBUTE_NODE)
  +		{
  +			score = xpath.s_MatchScoreNone;
  +		}
  +		else
  +		{
  +			opPos += 3;
   
  -		score = nodeTest(xpath, executionContext, localContext, opPos, argLen, stepType);
  +			score = nodeTest(xpath, executionContext, localContext, opPos, argLen, stepType);
  +		}
   		break;
   
   	default: