aspose file tools*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java- XML" Watch "Java- XML" New topic

Java- XML

Saiprasad Natarajan

Joined: Oct 27, 2010
Posts: 12


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?

Kshitij Chandrasen

Joined: Oct 11, 2010
Posts: 8
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).
I agree. Here's the link:
subject: Java- XML
Similar Threads
Named Query
Problem reading XML
Can not get MBean-JMX
Getting HibernateException: Errors in named queries
XSL Doctype Declaration