• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

attributes

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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




>
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"> ?







 
Marshal
Posts: 28296
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Police line, do not cross. Well, this tiny ad can go through:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic