Reputation: 3224
I want to select node element by 2 conditions. For example:
<bbb>
<aaa name="param1">val1</aaa>
<aaa name="param2">val2</aaa>
<aaa name="param3">val3</aaa>
</bbb>
I want to get element aaa, with attribute name = "param1". What's the best way to do that?
Upvotes: 0
Views: 1004
Reputation: 403441
Assuming you've already parsed the document with Dom4j, then...
Document doc = ...
Node node = doc.selectSingleNode("//aaa[@name='param1']");
... should work. The node
variable should contain your desired element.
Upvotes: 1