1
votes

First, and sorry, Im a mule newb. Im trying to take a large XML file and split it into multiple files. I keep running into out of memory exceptions. I understand that I need to stream so Im not loading everything into memory, but from there my google-fu is letting me down. So I have the following questions:

  • Is there a way that I can make this happen without writing code (simply via a mule flow)?
  • What are the basic steps? Not asking for a complete solution, just a push in the right direction please. Here are the ones that I have tried and failed with:

File (streaming) -> DataMapper (streaming) -> Dom-to-Xml-transformer -> File

File (streaming) -> Splitter (using xpath) -> aggegator -> foreach (Dom-to-Xml-transformer -> File)

Thanks in advance.

2

2 Answers

0
votes

The current implementation of streaming in DataMapper works only for the output.

If you are receiving an InputStream that you'd like to stream you would need a previous step before DataMapper, which is to use a component or transformer and process that InputStream using SAX. You would actually need to write code.

0
votes

It looks like Mule provides its own implementation of StAX

http://www.mulesoft.org/documentation/display/current/XmlToXMLStreamReader+Transformer

I'm not sure if it works well, but it could definitely be of help for your problem