FreeMarker Build XML
I always prefer Java template, if any kind of predefined data structure need to be build. For example if you want to send email to somebody in HTML format with style and color as you have seen in this tutorial using Apache velocity template or if you have to create predefined XML file with dynamic data. Here I will show you how you can iterate java object (Peerson) and dynamically create XML file from FreeMarker template.
- Project structure:
- Person.java – This is main class where we will store all XML data in list and dynamically replace its value to the template and create XML file.
- For more details please visit FreeMarker official tutorial here
Download Project: FreeMarkerCreateXMLFile