Not part of regular build. Added fix for expressions starting with '/'

This commit is contained in:
kvisco%ziplink.net 2000-11-07 10:42:35 +00:00
Родитель 6c4b489af2
Коммит 6e4d722387
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -29,7 +29,7 @@
* - foo//bar would not match properly if there was more than
* one node in the NodeSet (nodes) on the final iteration
*
* $Id: PathExpr.cpp,v 1.3 2000-05-29 07:15:17 kvisco%ziplink.net Exp $
* $Id: PathExpr.cpp,v 1.4 2000-11-07 10:42:35 kvisco%ziplink.net Exp $
*/
#include "Expr.h"
@ -239,7 +239,11 @@ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) {
case PARENT_OP:
{
Node* parent = cs->getParentNode(node);
if (parent) return pxi->pExpr->matches(node, parent, cs);
if (parent) {
//-- make sure node is Document node
if (parent->getNodeType() == Node::DOCUMENT_NODE)
return pxi->pExpr->matches(node, parent, cs);
}
break;
}
default:
@ -285,6 +289,11 @@ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) {
{
Node* parent = cs->getParentNode(tnode);
if (parent) {
//-- make sure we have a document node if necessary
if ( !iter->hasNext() )
if (parent->getNodeType() != Node::DOCUMENT_NODE) break;
if (pxi->pExpr->matches(tnode, parent, cs))
tmpNodes.add(parent);
}