The solution below eliminate fields that include wild card characters * or ?. It may also fail if quotes are included in a field.
@echo off
setlocal EnableDelayedExpansion
set "part="
call :ProcessFile < file.xml > fileWithNL.xml
goto :EOF
:ProcessFile
set "line="
set /P "line="
set "line=!part!!line!"
if not defined line exit /B
for %%a in ("!line:><=>" "<!") do (
set "part=%%~a"
if "!part:~-1!" equ ">" (
echo !part!
set "part="
)
)
goto ProcessFile
EDIT: New hybrid method added
The new solution below is a Batch-JScript hybrid script that is more efficient than the former pure Batch solution and have not its limitations. Copy the code in a file with .bat extension.
@set @a=0 /*
@cscript //nologo //E:Jscript "%~F0" < file.xml > fileWithNL.xml
@goto :EOF */
WScript.Stdout.Write(WScript.Stdin.ReadAll().replace(/></g,">\r\n<"));
xml.exefrom the batch file. In any case, avoid DIY XML parsing :)