I have to disagree with the index array not being useful. In fact, I see it as being absolutely necessary in the example I used, due to multiple <random> tags being used. Otherwise, how would you be able to distinguish which LI values belong to which RANDOM tag? It’s not really possible to do that without the index array.
The more I look at using xml_parse_into_struct though, the more I see that it’s use will probably cause more problems than it solves. For now I’ll concentrate more on streamlining the current code and getting it to parse templates more efficiently. At least I know that what I’ve written so far works (if slowly).