I need to modify the content of all html content to be sent as response from our server according to the tag. say for example, only text content inside a td or div tag will be modified. As per solution we have thought the content will be captured in the Filter of the server. Here, we will split the content against tag and modify the desired text, and then merge them again.

Thanks Michel for the thought. But this is not fulfilling the requirement. The reason is I need the whole array of 17 elements as in the example. Then only I can recreate the html after specific modifications.

for some reason I cannot provide exact example here. but the given one is pretty workable, I believe. In the example I have just taken a small part of a whole html response, so obviously it will have start and end tag of html, body etc., all in right places.

now, say for some specific tags, I need to change the text; say I will append "#". Hence,
1. "Claim Event Code &nbsp;" will become "Claim Event Code &nbsp;#"
2. "Notified" will become "Notified#"
3. "Opened" will become "Opened#"

This modification can be possible if I have the whole array of that 17 elements (see 1st post, please) with me, and I would now be able to append all these elements and send as a complete html response.

sql soln is quite time consuming as there will be db connection and this process is required for each and every response from server.

I opted an approach. 1st I modify the response with an extra "#" (or could be any special character that can be used as separator) before "<"(tag start) and after ">"(tag end). so now code will look like --

Now simple Java coding can be used to separate this into an array using "#". consecutive "#"es need to be ignored. so now I can scan the array, check any desired tag and opearte (and modify, too) the next element as I wish. Then I will recreate my response, just concatinating the array.

Using db connection may make the response slower. more over, tag wise opeartion may vary and managing them in sql, I feel, bit complex. But the query was good and I had learnt something new. Thanks Michel.