XPathNavigator.Evaluate returning incorrect value?
Posted
by
Eric
on Stack Overflow
See other posts from Stack Overflow
or by Eric
Published on 2012-04-14T11:23:47Z
Indexed on
2012/04/14
11:29 UTC
Read the original article
Hit count: 259
I'm expecting this code to return true but it doesn't ? What am I missing here.
string xml = @"<data><e id=""NUM_CPUS"">1</e><e id=""ACE_PRESENT"">1</e></data>";
XPathDocument doc = new XPathDocument(new StringReader(xml));
string expr = "(id('NUM_CPUS'))>=1 and (id('ACE_PRESENT'))=1";
XPathNavigator nav = doc.CreateNavigator();
XPathExpression query = nav.Compile(expr);
object result = nav.Evaluate(query);
bool b = bool.Parse(result.ToString());
if (!b)
throw new Exception("Should be true");
© Stack Overflow or respective owner