XML : Replacing a string in multiple xml files with text sourced from external file

A script or other application would be handy to do this, I'm using Windows. Basically, I have 47 xml files which each have a node attribute: id="XXXXXX". I've put the XXXXXX string in as an easy string to search for and later replace.

However, I need to make this string unique in each node, and there's 25 in each file (1175 in all). I have a list of ids I can use and if it helps I can save it in multiple ways - plain text, csv, separated by a new line etc - but I would rather not copy and paste each of the 1175 new IDs by hand. Is there some way of using batch script or powershell - or any already existing application - that can look through the 47 xml files and replace the XXXXXX with a string from the text file, and then move on accordingly?

No comments:

Post a Comment