aspose file tools*
The moose likes XML and Related Technologies and the fly likes attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "attributes" Watch "attributes" New topic
Author

attributes

James Howerton
Ranch Hand

Joined: Mar 14, 2009
Posts: 82
I am sending a string that represents the value of an attribute I would like to find. to this class.

I can print out the name of the attribute.
How can I print out the value part of the attribute?
Thanks




>
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Once you have the Element, you can use the getAttribute( name ) method.

Alternately you can get the Attr object corresponding to the name with getAttributeNode( name ).

Incidently, the org.w3c.dom.Node JavaDocs have a lovely table summarizing what the getNodeName() and getNodeValue() methods return for various kinds of Node such as Attr.

Bill
James Howerton
Ranch Hand

Joined: Mar 14, 2009
Posts: 82
Hello.
How can I print out the values of all the tags below the <keyName key="cmaj">
I can only get the first one.

Is it possible to retrieve each of the names of the <element> of each of the elements below <keyName="cmaj"> ?







Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

James Howerton wrote:Hello.
How can I print out the values of all the tags below the <keyName key="cmaj">
I can only get the first one.

Is it possible to retrieve each of the names of the <element> of each of the elements below <keyName="cmaj"> ?

Indeed it is possible. In fact you have some code which is very much like what you should do in your post, only it's commented out.

Your post was very long and filled with extraneous information -- did we really need to see all 25 elements you wanted to print? -- so I probably didn't give it the attention it needed.
 
Don't get me started about those stupid light bulbs.
 
subject: attributes