I need to make a small replacement in an XML file using DOS program. There is already a batch file made (REPL.BAT) which does replacements excellently (normal texts without double quotes or newline). However, this isn't working in the mentioned case;
Original Text:
---------------
<?xml version="1.0" encoding="utf-8"?>
<ichicsr lang="en">
Desired Text:
---------------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE ichicsr SYSTEM "http://abc.xyz.com/myxml.dtd">
<ichicsr lang="en">
Code: Select all
@echo off
set sourcepath="C:\PROJECT\CODE_ISSUE\IN_TMP"
set destpath="C:\PROJECT\CODE_ISSUE\XML_IN"
set bkppath="C:\PROJECT\CODE_ISSUE\XML_BKP"
for /r "%sourcepath%" %%a in (*.XML) do (
find "messagetype" <"%%a" >nul && (
echo processing "%%a"
type "%%a"|REPL "OLD TEXT WITH DOUBLE QUOTES AND NEWLINE" "NEW TEXT" >"%%a.bkp"
move /y "%%a.bkp" "%destpath%" >nul
move /y "%%a" "%bkppath%" >null
echo File "%%~nxa" processed and moved to "%destpath%"
)
)
Thanks,
Rahul