java - What is the xpath for retrieving all attribute nodes (whatever be the attributes name) with a specified value? -
following sample xml.
<library> <book id="aaa"> <title id="bbb">harry potter , half blood prince</title> <author id="ccc" ref="zzz"/> </book> <book id="ddd"> <title id="eee">harry potter , 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 many more books in example , many author details well. want, to retrieve attribute nodes, ever attributes name, specified value.
example, in above sample want xpath return following nodes. (all attribute nodes contain value of 'zzz', ever attributes name).
- ref="zzz" first book node.
- ref="zzz" second book node.
- and, id="zzz" author-details node.
i writing java code , want change value of id='zzz' other value.
well //@* gives attribute nodes, add predicate //@*[. = 'zzz'] , have attribute nodes value zzz.
Comments
Post a Comment