Given the following XML,
<root>
<property>
<programs>
<program>1</program>
<program>5</program>
</programs>
<tool>
</tool>
</property>
<property>
<tool>
<progra开发者_开发技巧ms>
<program>1</program>
<program>2</program>
</programs>
</tool>
</property>
</root>
how would I write an XPath expression to return a collection containing the "property" nodes when program=1? I think I want to write something like "give me all the property nodes when self or a descendant contains programs[program=1]", but can't get it to just give me the "property" nodes...
property[.//programs/program=1]
Selects the property
elements that contain descendant programs
elements that contain a child program
element who's value is 1
.
精彩评论