If it were me I would write a subclass of FilterReader which wrapped that ResultSet, or whatever it is where the XML comes from. If I understand it correctly, the simplest thing you can do is to just override the read() method which returns the next character, and let FilterReader take care of the rest.
And I'm a bit surprised that processing every record and processing the concatenation of exactly 1000 records are equally acceptable, since the parser expects to receive a complete XML document. If each record is a complete XML document then the concatenation of 1000 records cannot be a complete XML document.
Author and all-around good cowpoke
Joined: Mar 22, 2000
since the parser expects to receive a complete XML document.
Well, to be picky, the SAX parser only requires a stream that starts correctly for an XML document. It will generate SAX events as long as it gets a correctly formatted character stream. In many applications one would quit parsing once you found the right data. Hitting the end of the stream without the closing root element just causes an exception you should handle.
subject: sending xml records to sax parser using buffer