Writing XML Node To File

Hi all,

I’m creating a flow service which takes in an xml node as input and need to write its contents to a file. Currently, the node is being converted to a string, and then written to a file, but due to the size of the files, this is probably not the best solution.

Is there a better way to do this?

Thanks in advance!

Review the large file handling approaches for information on using a nodeIterator to iterate over a large XML document. You could use that approach to read a preset number of elements or bytes and use java IOStreams to write to your output file. This may be a bit (ok, maybe a lot) slower, but will have a much smaller memory footprint.

How large are your XML files?


Thanks for your response Mark. The files we’re expecting to use are about 40MB or so in size.