XPathNavigator navigator = 开发者_Python百科myApp.XML.CreateNavigator();
XPathExpression expression = navigator.Compile("true"); //works
XPathExpression expression = navigator.Compile("true or true"); //works
XPathExpression expression = navigator.Compile("true OR true) //'System.Xml.XPath.XPathException'
Because XPath operators are case-sensitive.
"or" is a keyword/operator in XPath, and as such is only going to be interpreted correctly in its lowercase form. Is that what you were looking for? XML and XPath are case-sensitive in general, but the keyword issue is the specific reason you're seeing the error you indicated in your post.
精彩评论