Groovier way to find next XmlSlurper element in parent?

Posted by Misha Koshelev on Stack Overflow See other posts from Stack Overflow or by Misha Koshelev
Published on 2010-06-11T00:38:18Z Indexed on 2010/06/11 0:42 UTC
Read the original article Hit count: 399

Filed under:
|

Dear All:

I am using:

def idx=parent.item.children().indexOf(myElement)
if (idx+1<parent.children().size()) {
  def message=parent.children()[idx+1]
  println message.text()
}

To find the element message which is next after myelement in the parent.

However, it seems there must be a Groovier way, no?

Thank you Misha

© Stack Overflow or respective owner

Related posts about groovy

Related posts about xmlslurper