You really need to use a tool specifically designed for XML management.
But as a last resort, you can use any tool that can search for and replace regular expressions to make a naive decision that will work with the file as you have outlined it, but it may fail with a logically equivalent XML file that has been remade physical layout.
I like to use the hybrid JScript / batch utility that I wrote under the name REPL.BAT to manage text files using batch scripts. The script will run on any native Windows machine with XP, and does not require the installation of any third-party executable files. Click the link to get the script code and a more detailed description.
Using REPL.BAT, a quick and effective but naive solution is as simple as:
setlocal enableDelayedExpansion set "newValue=myNewValue" type "fileName.xml"|repl "(<InstallationType>).*(</InstallationType>)" "$1!newValue!$2" >fileName.xml.new move /y "fileName.xml.new" "fileName.xml"
dbenham Jun 12 '13 at 4:44 2013-06-12 04:44
source share