Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML DOM Document reading elements

 
felix thomas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Could anyone tell me how can i read XML DOM object and find out the element it contains .
document.getElementsByTagName is there but i have to give the tag name .
I there any other method we can fin out the elemts and their values without knowing the tag names.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getChildNodes() gives you a list of all child nodes of the current node. If you're starting out from the root element, that's all you need to traverse the whole document.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
document.getElementsByTagName ("*") return all tags
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic