File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes XML DOM Document reading elements 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 "XML DOM Document reading elements" Watch "XML DOM Document reading elements" New topic
Author

XML DOM Document reading elements

felix thomas
Ranch Hand

Joined: Jun 10, 2001
Posts: 89
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

document.getElementsByTagName ("*") return all tags


Groovy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML DOM Document reading elements