how to get attribute key/values with XMLSlurper?

21 views
Skip to first unread message

Bob S

unread,
Jan 15, 2021, 7:26:59 PM1/15/21
to Jenkins Users

I'm using XMLSlurper to read a short xml file.  For a given node I can get its attributes using 'attributes()', and I can get the size() of that to know how many there are.  But I can't figure out how to get each attribute's key and value.

If I know an attribute is, say "Name"="Jim", I can say Node.@Name to get "Jim" back.  But what if I want to iterate over all the attributes and store both the key and the value in a list?

Thanks for any suggestions!
Reply all
Reply to author
Forward
0 new messages