pakman
pakman

Reputation: 1735

How to efficiently (stream) process XML file in Mule 3?

My requirement is to (efficiently) read an XML file using streams (Stax) instead of loading the whole DOM in memory (JAXB).

Anyone knows how to process an XML using the XmlToXMLStreamReader?
As usual Mule documentation is extremely frugal.

I have a

<custom-transformer class="org.mule.module.xml.transformer.XmlToXMLStreamReader"/>

in my flow. Now what?
How can I process a start tag at a time?
What kind of payload it generates? In the debugger, I can see that it is a org.mule.module.xml.util.XMLUtils. I thought I would get a Stax XmlStreamReader.

Any help/example would be much appreciated.

Upvotes: 1

Views: 1235

Answers (1)

David Dossot
David Dossot

Reputation: 33413

The org.mule.module.xml.transformer.XmlToXMLStreamReader transforms the current payload into a javax.xml.stream.XMLStreamReader. Now it's up to you to add another custom transformer/component to do something with this XMLStreamReader.

Upvotes: 2

Related Questions