• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading data from XML

 
yathish Gatty
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using SAX parser to parse the XML file and read the content.It works fine.But if it is large XML file about 1MB it takes 20-25 miniutes to parse it.The code that reads the data is given below.Can someone please suggest a solution to this.

String data="";
public void characters(char[] ch, int start, int length)
throws SAXException {

if (thisElement == "data") {

data = data+new String(ch, start, length);
System.out.println("Data :"+data);


}

}

Thanks in advance.

Regards,
Yathish.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parsing a 1MB file to grab the content of <data> elements should not take more than a few seconds as far as the parser actions are concerned. You must have other time consuming things going on, such as that System.out.print().
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic