Raj
Raj

Reputation: 2920

Freemarker: Reproduce XML

Folks, I am working on a freemarker template that needs to reproduce parts of the input XML tree.

I would love to have a macro that I could invoke as follows:

<@renderTree node=node namespace="ns"/>

Anyone have something like this handy?

Thanks.

-Raj

Upvotes: 0

Views: 765

Answers (1)

Raj
Raj

Reputation: 2920

Freemarker has a special hash key for this: @@markup. So, my example above:

<@renderTree node=node namespace="ns"/>

Where variable "node" contains an XML node, will be written as:

${ node[ "@@markup" ] }

More info here: Freemarker Manual XML processing

Upvotes: 1

Related Questions