View Single Post
  #13 (permalink)  
Old 01-07-2008, 03:00 PM
jelly's Avatar
jelly jelly is offline
Member
 
Join Date: Jan 2008
Location: Somerset, UK
Posts: 46
Rep Power: 0
jelly is on a distinguished road
Default
It looks like you are trying to run a SAX parser hence the extension of DefaultHandler? What exactly does:

private void parseDocument()
{
/** Reads the file**/
}

do? Are you not showing code here or is that it as written ( if so then your ArrayList will never have data in it. I would have expected to see a SAXParser being set up and handed an instance of your handler. The way SAX works is that it parses the XML document for you and calls back into your handler.

In passing be careful of your code in the characters method, SAX does _not_ guarantee that it will only call you once for each tags data, it may make several calls passing you part of the data each time so you should alter your code to _append_ the info as shown below:

tempVal += new String(ch,start,length);
Reply With Quote