This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Thanks for the reply Lasse. I should have explained it bit clearly in my initial post. Actually I was looking for various possible ways to acheive this. Using Java is one way, but is there some other way? I need this tool to be as generic as possible. It should be possible for me to modify the variable file and / or the template file with out changing the code. I could very well use your logic and create this utility, but I would like to check if there are any tools available to acheive the same.
Joined: Jan 23, 2002
How about using simple variable placeholders like <some-element>@myvariable@</some-element> and run a brutal search-and-replace over the whole document? That should work regardless of how the template is changed as long as the expected variable placeholders are found somewhere within the document. Similarly, you wouldn't need to touch the code unless you change the way you mark-up your variable placeholders.