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 Reading XML Values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Reading XML Values" Watch "Reading XML Values" New topic
Author

Reading XML Values

Raistlen Majere
Greenhorn

Joined: Aug 03, 2009
Posts: 13
I want to retrieve all values from an xml no matter what the tag. Currently I have the code working for a normal xml:


The problem I am having is when I need to read the value of a tag in the following format:

<import resource="somecustomconfig.xml" />


I need to extract the "somecustomconfig.xml" and I can not get it to work. Is there a quick fix to this using my current code structure?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38461
    
  23
Too difficult a question for "beginning Java". Moving.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

element.getAttribtue(String name)?
Raistlen Majere
Greenhorn

Joined: Aug 03, 2009
Posts: 13
element.getAttribtue(String name)


The only problem is I will not know the contents of the xml, so I can not pass it name parameter.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're reading random XML?

public NamedNodeMap getAttributes()

Reading the API will help you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading XML Values