Hi,
I am using xerces 3.0.1 and evaluating an XPath expression "a/b/c".
DOMNode* GetNode(DOMNode* startingNode , XMLCh* xpathStr)
{
DOMDocument *doc = m_pParser->getDocument();
DOMXPathResult* result=doc->evaluate(
xpathStr,
startingNode,
NULL,
DOMXPathResult::FIRST_ORDERED_NODE_TYPE,
NULL);
if(result)
{
DOMNode* tt = result->getNodeValue();
result->release();
return tt;
}
else
return NULL;
}
The time taken by GetNode is approximately 0 milliseconds when path a/b/c
exists in the document.
But the time taken is 40 milliseconds when path a/b/c doesn't exist.
Please explain this behavior. Is there any way to reduce the time taken for
XPath evaluation when the node doesn't exist?
Thanks
Mini