I have an scenario where I need to reverse map the Freemarker template xml key and output xml value into a Map<Key, Value> . e.g.
Freemarker Template:
<employee>
<name>${emp_name}</name>
<age>${emp_age}</age>
<department>${emp_department}</department>
<salary>${emp_sal}</salary>
</employee>
Typical Freemarker output from above template by providing Map<key,Value> to template engine.
<employee>
<name>John</name>
<age>21</age>
<department>Software</department>
<salary>7000k</salary>
</employee>
Usually, injecting Map to template xml maps the value and generate an output xml. However, the problem here is, we have template xml and output xml but require the Map<key, value> from these two xml.
Like in above case I would like to have {(emp_name,John),(emp_age, 21),(emp_department,Software),(emp_sal,7000k)} from these xml.
Please note there are no template to Object mapping in Java code as template is changed and deployed to server often.
No comments:
Post a Comment