This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I need to display only those values which comes under tag name : <jndi-name>xyz<jndi-name>
But still it prints all the values of xml file.
If the way of conducting the logical reasoning for sax parsing's handler remains at the known-to-be-able level, it can be quite challenging when you actually need to do it without all reasoning seemed frozen up...
This is how you can consider: focusing your attention also on the wrapper element of those data you want to extract, that is local-tx-datasource. Make up a flag to decide whether to collect the data or not. Partial data are then cached or stored as the parsing getting its way linearly. The confirmation of data collection comes at the time the parser meets up jndi-name and gets its text being xyz (supposing though jndi-name tag is unique within the wrapper element - other you have to do more work.) Once it is confirmed, the data is poured out when the parser comes across the closing tag of the wrapper element. If the confirmation is negative, the data collection process is abandoned to safe up useless effort.
This is one way to implement it and how the handler would look like, based generally on you have at this stage.