Following is a sample xml.
<library> <book id="aaa"> <title id="bbb">Harry Potter and the Half Blood Prince</title> <author id="ccc" ref="zzz"/> </book> <book id="ddd"> <title id="eee">Harry Potter and the Philosophers Stone</title> <author id="fff" ref="zzz"/> </book> <author-details id="zzz"> <firstName id="ggg">Joanne</firstName> <lastName id="hhh"/>Rowling</lastName> </author-details> </library>
There are many more books in this example and many author details as well. What I want, is to retrieve all attribute nodes, what ever be the attributes name, with a specified value.
For example, in the above sample I want the xpath to return the following nodes. (all attribute nodes that contain the value of 'zzz', what ever be the attributes name).
- ref="zzz" from the first book node.
- ref="zzz" from the second book node.
- and, id="zzz" from author-details node.
I am writing Java code and want to change the value of the id='zzz' to some other value.