wood burning stoves 2.0*
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
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: 37970
    
  22
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.
 
jQuery in Action, 2nd edition
 
subject: Reading XML Values
 
Similar Threads
JAXB namespace use in XML files
Dom parser for XML file
need help in edit the xml using dom parser
[JAVA] XML reader
xml tags writing