Suppose this is my XML:\[code\]<myxml> <data key="true">Apple</data> <data key="true">banana</data> <data1 key="true">banana</data1> <data>Apple</data></myxml>\[/code\]I need an XPath expression for the tag which contains attribute \[code\]key="true"\[/code\] and node value = http://stackoverflow.com/questions/10541576/\[code\]Apple\[/code\].I tried different combinations but not succeeded.
- For attribute I use this \[code\]xpath="/myxml/data[@key='true']\[/code\]
- and for Node value I use this \[code\]xpath = "/myxml/data[. ='Apple']/\[/code\]
- and also try this \[code\]xpath = "/myxml/data[.='Apple'][@key='true]/\[/code\]