Make the XPath engine handle CDATA sections as text-nodes.

b=92786 r=peterv, pike sr=jst

Mixed small fixes and comments.
b=99792 r=peterv sr=jst


git-svn-id: svn://10.0.0.236/trunk@103025 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sicking%bigfoot.com
2001-09-17 23:02:57 +00:00
parent 1d23a9848c
commit b44d102f77
12 changed files with 39 additions and 56 deletions

View File

@@ -33,19 +33,8 @@
* @return the result of the evaluation
**/
ExprResult* TextExpr::evaluate(Node* context, ContextState* cs) {
NodeSet* nodeSet = new NodeSet();
if ( !context ) return nodeSet;
Node* node = context->getFirstChild();
while (node) {
if ( node->getNodeType() == Node::TEXT_NODE )
nodeSet->add(node);
node = node->getNextSibling();
}
return nodeSet;
NS_ASSERTION(0, "TextExpr::evaluate called");
return 0;
} //-- evaluate
/**
@@ -61,8 +50,9 @@ double TextExpr::getDefaultPriority(Node* node, Node* context, ContextState* cs)
* the given context
**/
MBool TextExpr::matches(Node* node, Node* context, ContextState* cs) {
if ( node ) {
if(node->getNodeType() == Node::TEXT_NODE)
if (node) {
if (node->getNodeType() == Node::TEXT_NODE ||
node->getNodeType() == Node::CDATA_SECTION_NODE)
return !cs->isStripSpaceAllowed(node);
}
return MB_FALSE;