On Sun, Jan 15, 2017 at 5:43 AM Daniel Dekany <[email protected]> wrote:
> 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. > Hmm so the real reason I wanted to do it directly was to avoid adding code. Sounds like I'd still have to make code changes. Ok. Thanks! > > -- > Thanks, > Daniel Dekany > >
