I am trying to determine whether a certain value actually appears in the xml file or not. However, there seems to be no way of telling. If I request an invalid or non-existant XPath I get an empty string and no nodes in the node set as return. If I request a valid XPath expression which correctly evaluates to an empty string I get exactly the same result. The processor's state variable indicates e_error_no in both cases.
So, how can I tell the difference between an error state and an empty string return?
My best guess was the following:
TinyXPath::xpath_processor processor( m_Document->RootElement(), key.c_str());
if ( processor.u_compute_xpath_node_set())
m_CachedResults[key] = processor.S_compute_xpath().c_str();
m_CachedResults[key] = defaultValue;
Doesn't help to differentiate between the following however:
expression "/test/@text()" returns e_error_no, no nodes and an empty string.
expression "/an/invalid/path" returns e_error_no, no nodes and an empty string.
what am I to do?
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.