This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 36453
    
  15
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
 
Similar Threads
[JAVA] XML reader
need help in edit the xml using dom parser
Dom parser for XML file
JAXB namespace use in XML files
xml tags writing