Two Laptop Bag
The moose likes XML and Related Technologies and the fly likes Transforming large XML files with FreeMarker Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Transforming large XML files with FreeMarker" Watch "Transforming large XML files with FreeMarker" New topic
Forums: Other Open Source Projects XML and Related Technologies

Transforming large XML files with FreeMarker

Chris Zaremba
Ranch Hand

Joined: Nov 22, 2010
Posts: 54

I need to transform XML files into various other formats such as CSV, HTML, ODT etc.. In a previous project I did this using XSLT and although I got it working it was a bit of a slog. Getting certain things to work like escaping characters, managing white-space and more was just so awkward. I am a big fan of FreeMarker and I know it can work with XML files so this would be ideal. My concern is whether it can handle large XML files efficiently. Looking at the API and source it looks like it loads the entire XML file into memory instead of streaming it. The XML source files could be a couple of hundred MBs and I might need to process a few at a time. Does anyone have any experience of using FreeMarker with such large files. What was it's memory usage like?

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

I put a copy of this post in the "Other Open Source Projects" forum to see if any Freemarker users might notice it there. And perhaps the authors of "Taming Text" might have a comment as well?
I agree. Here's the link:
subject: Transforming large XML files with FreeMarker
It's not a secret anymore!