This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes How to find highest element in xml file using SAX Parser? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to find highest element in xml file using SAX Parser?" Watch "How to find highest element in xml file using SAX Parser?" New topic
Author

How to find highest element in xml file using SAX Parser?

Rahul Noel
Ranch Hand

Joined: Jul 18, 2008
Posts: 51
Hi,
How to find highest element in xml file which contains employes details like name,salary I want to find highest salary of employee in company using SAX Parser.


Thanks in Advance.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
You will need to capture the contents of the text following a <sal> element using a custom extension of org.xml.sax.helpers.DefaultHandler.

A SAX parser will call your startElement() method when the <sal> element is encountered. There will then be one or more calls to your characters() method where you need to capture the text. Next there will be an endElement() call when </sal> is encountered - at that point process the captured text to extract the numeric value.

Bill
 
 
subject: How to find highest element in xml file using SAX Parser?