wood burning stoves 2.0*
The moose likes Java in General and the fly likes Java- XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java- XML" Watch "Java- XML" New topic
Author

Java- XML

Saiprasad Natarajan
Greenhorn

Joined: Oct 27, 2010
Posts: 12

Hi

I have an XML which is something like this:



All i want to do is get the queryValue by passing the queryName.
For ex: if I pass "CreateTask" to some function, the return value shoud be "Creating".

I am not sure if the DocumentBuilderFactory and other classes retrieve the value based on name.

Any pointers please?

TIA
Kshitij Chandrasen
Greenhorn

Joined: Oct 11, 2010
Posts: 8
Sai,
Yes the DOM parser doesn't do that. You will have to retrieve the "Query" tag elements as a NodeList and then iterate over them to perform search. Also, since the "queryname" and the "queryvalue" tags appear in pairs, you can actually directly retrieve these tags directly by using the getElementsByTabName(..) method and create a HashMap by mapping indices (As I said, since the items appear in pair, the index mapping would work fine).
Thanks
Kshitij
 
Consider Paul's rocket mass heater.
 
subject: Java- XML
 
Similar Threads
Getting HibernateException: Errors in named queries
Named Query
Problem reading XML
XSL Doctype Declaration
Can not get MBean-JMX