I need to iterate over the characters in a string to build an XML structure.
Currently, I am doing this :
If the string length is not huge, you can use a recursively called template to achieve this, passing the index of the character to be processed as parameter into the template.
Like so:
Some text
If the string is longer than that, you can use a similar approach but with a divide-and-conquer algorithm, so that you have a maximum recursion depth of log2(string-length), like so:
Some text