File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Spring in Action this week in the Spring forum!
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
Author

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?


SCJA, OCPJP, OCMJD
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

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?
 
Don't get me started about those stupid light bulbs.
 
subject: Transforming large XML files with FreeMarker