Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes Getting the value from an attribute 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 » Engineering » XML and Related Technologies
Bookmark "Getting the value from an attribute" Watch "Getting the value from an attribute" New topic
Author

Getting the value from an attribute

phillip nash
Greenhorn

Joined: Feb 08, 2011
Posts: 21
Hello. I'm starting out using XML within my java program. I've managed to retrieve all of my elements etc, but I dunno how I retrieve my groupNumber (in this case its 3). The structure of my XML file is below, I've omitted the employee data for brevity.



Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
When you have a "Group" Element, use the methods in org.w3c.dom.Element to manipulate attributes.

While you have the JavaDocs for the org.w3c.dom package open, study the Node Javadocs - there is a table which every XML programmer needs to be familiar with.

Bill
 
Don't get me started about those stupid light bulbs.
 
subject: Getting the value from an attribute
 
Similar Threads
Caught: groovy.lang.MissingPropertyException while excuting my DSL
Hibernate and a Table called [group] - problem
Cannot create iterator for FormBean
Many-to-one mapping issue
Writing linked list to an XML file.