[Servingxml-help] Writing to a buffer
Brought to you by:
danielaparker
|
From: Ravikumar T. <ra...@gm...> - 2007-03-29 00:49:18
|
Hi I am converting a large flat file to xml using servingXml. I am trying to write the xml to a buffer instead of a physical file. After certain number of lines/records are transformed to xml, I am planning to invoke a listener or trigger which would consume/process the xml generated so far and return control so that the next set of records are converted. I am considering the following approach: Write a record filter and maintain a count of records. After the desired number of records are written, I notify a listener which can process the xml produced so far. I see an issue with this. The writeRecord method doesnot tell me if I am at the end of the file. So I wouldnot know when to fire the listener for the last set of records. Please let me know if this approach can be followed. Regarding writing to a buffer, I would like to use a java.io.StringWriter so that I can read from it. But OutputStreamSinkAdaptor doesnot take a java.io.Writer as a parameter to the constructor. It would only take an OutputStream. Is there any other way I can write to a buffer which can also be read and cleared while the xml transformation is in progress. Regards Ravi |