I am going to check that if a dom tree java object contains another dom tree java object or not? what is the most efficient way of doing that?
If I use recursive method for that probably the whole process would be really time consuming so is there any efficient way for traversing DOM tree for check this?
For example take a look at this xml:
<a class='x'>Hello
<b>How are you?</b>
<a class='x'>I am fine!</a>
</field1>
When I use xpath ".//*[@class='x']" two node would be selected that one of them is parent of the another one. I want to select the parent one only. For this purpose somehow I have to check whether one of the selected nodes (which are both DOM tree) is a child of another DOM tree or not.