aspose file tools*
The moose likes XML and Related Technologies and the fly likes reading data from XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "reading data from XML" Watch "reading data from XML" New topic
Author

reading data from XML

yathish Gatty
Ranch Hand

Joined: Oct 05, 2004
Posts: 31
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

Joined: Mar 22, 2000
Posts: 12789
    
    5
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
 
wood burning stoves
 
subject: reading data from XML