Get Attribute from Xpath

qtwqwc

New Member
I need a method that can give me back the value of a specified attribute inside a specified xpath. So for example if we have \[code\]xpath = /root/foo/body/part[5]/test[3]\[/code\] and we want the value of the attribute \[code\]id\[/code\] inside the \[code\]test[3]\[/code\] tag of the xpath then I need to be able to call a method that looks something like this:\[code\]public String getAttributeValue(String xpath, String attribute) { String attributeValue = "http://stackoverflow.com/questions/14478142/xpath/attribute".value(); return attributeValue;}\[/code\]
 
Back
Top