Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rahul Noel
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic