Reputation: 12347
I have this xml, I want to check the existence of price
node if present then do set of actions else move on.
<game>
<genre>
<action>...</action>
<racing>...</racing>
<price>
..
..
</price>
</genre>
</game>
How can I achieve this in groovy?
Upvotes: 2
Views: 4375
Reputation: 12347
Hey I got the answer, this works fine for me.
xml is the GPathResult object that has the xml in it.
xml.children().find {it.name()=="price"}
//will return true if price
exists
Upvotes: 2