我期待这段代码返回true,但它没有?我在这里想念什么。
string xml = @"<!DOCTYPE root [ <!ELEMENT e (e*) ><!ATTLIST e id ID #REQUIRED>]>
<data><e id=""NUM_CPUS"">2</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");