Sunday, January 15, 2017, 12:39:12 AM, John D. Ament wrote: > Hi, > > I was wondering, are there any features in freemarker that would allow me > to parse an XML file and loop through its contents? This would need to be > directly within the freemarker template. > > John
If you really have to load the XML file from the template (which is unusual), then write a TemplateMethodModelEx that calls freemarker.ext.dom.NodeModel.parse(InputSource). The result can be traversed as described at http://freemarker.org/docs/xgui.html. Of course, normally, you load the XML before that template is called, and pass the W3C DOM Node or the NodeModel to it through the data-model. -- Thanks, Daniel Dekany
