This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Groovy and the fly likes How to get attribute names of XML tags in groovy? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "How to get attribute names of XML tags in groovy?" Watch "How to get attribute names of XML tags in groovy?" New topic
Author

How to get attribute names of XML tags in groovy?

Nazeer Ahammad
Ranch Hand

Joined: Feb 26, 2012
Posts: 43
Hi All,
I need one help. Please see the below xml file content

<students>
<student name="###" id="###" college="###"></student>
<students>

In the above xml, I need to display attribute student tag names(name,id and college).
How can i do this in Groovy.
Please help me.

Thanks,
Nazeer.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3068
    
  33

I remember writing a blog post on parsing XML using XmlSlurper in Groovy where I have mentioned how to access the attribute name. The same can be found here.

PS: Sorry for plugging in my blog, but the post serves your query.


Mohamed Sanaulla | My Blog
Pankaja Shinde
Ranch Hand

Joined: Sep 15, 2006
Posts: 87
http://groovy.codehaus.org/Reading+XML+using+Groovy's+XmlParser
 
Consider Paul's rocket mass heater.
 
subject: How to get attribute names of XML tags in groovy?
 
Similar Threads
how to retrieve value of attribute of an xml element tag using jsp
Parsing XML in Groovy
question about AttributeList interface
Validations for form created with JSTL's x:transform
How to update the xml tag attributes for the given tag