Tuesday, June 29, 2010

XMLSlurper trying to annoy me

Just a little note: If you ever wonder why you're iteration of XMLSlurper elements does not work: Try inserting a .children() before the .each(). Have a look at this code, where you have one case where it works without and in the second place only with .children():

ncbiXML.GBSeq.'GBSeq_feature-table'.GBFeature.each{feature ->
 if((feature.GBFeature_key as String) == "CDS")
 {                   
  feature.GBFeature_quals.children().each{qual ->
  }
 }

No comments:

Post a Comment