I have the following script and you need some advice:
The user enters a text document as a template and provides some parameters at runtime, so I can query my database and get the data to fill out the document. So there are two main things I need to do:
- Replace each key in the document with the corresponding result of the current query string.
- To "merge" (copy? Duplicate?) An existing document without changing it to itself (add) depending on how many lines I received from the request, and replace the keys from this new copy with the following line values.
What is the best aprroach for? At the moment, I have managed to complete the replacement using the unmarshallfromtemplate template, providing it with a hash map. But this method is a bit complicated because I need to add "$ {variable_name}" in the document, and sometimes the word separates the "$ {" and "}" in different tags, causing problems.
I read about xml custom binding, but didn't understand it completely. Do I need to create custom XML, paste it into the document (all this is not runtime) and call applybindings? If so, how would I link the fields in the document with xml? By the name?
source share