Guest User

Untitled

a guest
Aug 20th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. No such field found: field groovy.util.slurpersupport.NodeChild primary
  2.  
  3. script {
  4. def xml = """
  5. <colors>
  6. <color primary="true">Red</color>
  7. <color primary="true">Yellow</color>
  8. <color primary="true">Blue</color>
  9. <color primary="false">Purple</color>
  10. </colors>
  11. """
  12.  
  13. def colors = new XmlSlurper().parseText(xml)
  14. echo "First Color: ${colors.color[0]}" //works fine
  15. echo "First Color: ${colors.color[0]} Primary? ${colors.color[0].@primary}" //fails
  16.  
  17. }
Add Comment
Please, Sign In to add comment