I develop a CAD program and I would like to create smart selection operation. The user could formulate search phrases to select/deselect elements in the project. I thought if I build an XML DOM for the elements in the project and I call xpath searches against the DOM to get the list of the matching elements in the project could work.
If I have an Element type with three fields and stored in XML as attr1
, attr2
, attr3
attributes as Element
tags:
<Elements>
<Element attr1="" attr2="" att3="">
...
<Element attr1="" attr2="" att3="">
</Elements>
How can I write an XPath equals to the following:
( attr1="value1" AND attr2="value2" ) OR attr3="value3"
Or here is another phrase just because you could not say : because of the operation priorities the parentheses are not necessary!
( attr1="value1" OR attr2="value2" ) AND attr3="value3"
I couldn't find anything about the usage of parenthesis in xpath on W3Schools. The call of the IXMLDocument calls are not necessary just the xpath phrases (if possible = there are parenthesis in XPath).
Or I have to do the logical operations on SearchNodes result lists manually?