On Mon, Nov 16, 2009 at 10:44, Oleg <[email protected]> wrote: > What for brackets are allowed in the property constraints to separate > logical operators? I want to build e.g. following query statement: > > //*[(@a = 'value1' and @b = 'value2' or @c = 'value3') and (@d = 'value4' or > @e = 'value5')] > > Is the syntax with round brackets correct?
Yes. > I known that AND has more > strength than OR and some brackets are needed sometimes for the right query > expression. Right? The operator precedence in XPath 1.0 is (from lowest to highest) is: or, and, = / !=, <= / < / >= / > [1], hence your "a and b or c" (shortened) will be interpreted like "(a and b) or c". Personally I always use brackets in any language to avoid any mistakes. Leaving them out is just a convenience, after all. [1] http://www.w3.org/TR/xpath#NT-OrExpr Regards, Alex -- Alexander Klimetschek [email protected]
