Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 Building Microservices this week in the Design 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: 13005
    
    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
 
Have you checked out Aspose?
 
subject: Getting the value from an attribute
 
It's not a secret anymore!