i need your help on a particular bit of code.
I have a document object in jdom. I also do have a element object for the root. Now i want to get a specific element based on the value of an attribute. But what i want to avoid, is to filter through the complete list of children, just to get one element. So is there some kind of way to filter on the value of a document.
Lets say my attribute value is ‘123’
Now i want the element where the ‘id’ value is ‘123’
What is the best way to do this?
Kind Regards.
I would use XPath for that. With the following expression:
//element[@attribute='value']