Hello everyone I am developing a program in Java to read the XML using XPATH for siblings nodes (elements which are same level)
I am not able to implement below XPATH expression in Java:
//*:root/*:child1[.='child_value']/following-sibling::*:child2[*:subelement]/*:subelement3/*:subelement4/following-sibling::*:anyelement
Could any one please suggest any solution
The construct
*:rootrequires XPath 2.0, which isn't supported by Xalan. The simplest solution is to use Saxon instead.In XPath 1.0 the way to select an element by local name alone is
*[local-name()='root']which gets a bit cumbersome for an expression like this that includes 7 such selections.