Xpath for item with same attribute value as ancestor

Markhas

New Member
How would I write an xpath query to match the \[code\]<subitem>\[/code\] element in the XML snippet below?Specifically I want to match any element that has a "name" attribute that matches the value of the "name" attribute of the root. There may be an arbitrary number of ancestors between \[code\]<root>\[/code\] and \[code\]<subitem>\[/code\].\[code\]<root name="xyz"> <anything> <subitem name="xyz" /> </anything></root>\[/code\]My goal is to write a PMD rule for finding cases of Logger.getLogger() that use a different class than the class the statement is in.
 
Back
Top