def list="<books>
<book>
<title>xx</title>
<year>xxxx</year>
<book>
</books>" (or)
def list="
<books>
<book> xxxx <book>
</books>";
def books=new XMLSlurper(list);
I have requirment like
if (books.book has value ) do something
else if(books.book has tag ) do something
Input can be either first or second which differs dynamically. How can I achieve above if condition without any iteration or with single check?.