SaxParser + Reading XML from a URL connection - Most effective way...

Currently now parsing XML stream from a URL connection and feeding into the SaxParser. I believe my code logic below is a slow way of doing this and think there's a more effective way.

It seems my code logic below is slow because it would read each byte from the URL stream and feed into the SaxParser. Correct me if im wrong. Is their a way to change the SaxParser buffer size before it does the actual parsing?

Whats the most effective way to use SaxParser with a XML input stream from a URL connection?

Is there a way to read chucks of data from a XML url and feed to SaxParser in one go? Code example would be appreciated...

SAXParser saxParser = factory.newSAXParser();

saxParser.parse(inputStreamFromURLConnection, saxDefaultHandler);

[779 byte] By [akhalil100a] at [2007-10-3 4:40:53]
# 1

You could try this:saxParser.parse(new BufferedInputStream(inputStreamFromURLConnection), saxDefaultHandler);

My expectation is that the speed of this is still going to be limited by the speed of whatever connection you are downloading from. However optimization based on guesswork is a bad practice, so ignore my guesswork and your own. Profile the application to see where the time is being spent before making any "improvements".

DrClapa at 2007-7-14 22:44:56 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...