Open, Add Line, Save, Next File Help
Posted: 05 May 2022 04:24
Hi.
i have a folder full of around 20 XML files that are created from a diagnostics program that does not provide a style sheet so i am adding one myself.
I am looking to create a Batch file that will open each XML, add the line "<?xml-stylesheet type="text/xsl" href="survey.xsl"?>" below the first "<?xml version="1.0" encoding="UTF-8"?>" line, then save the file, and move onto the next XML file and so on and so on until all the XML files have been edited and then stop.
The file names for the XML's would always remain the same, so if necessary the batch file could be told to run on a specific set of file names rather than operating on a "all files in a folder" statement if that helps?
Am a total beginner with these things and have only written very basic scripts so am a bit lost with this "open/add/save" one and thought it would be simple, but even begin to understand some of the examples i can find online.
Thanks in advance!
i have a folder full of around 20 XML files that are created from a diagnostics program that does not provide a style sheet so i am adding one myself.
I am looking to create a Batch file that will open each XML, add the line "<?xml-stylesheet type="text/xsl" href="survey.xsl"?>" below the first "<?xml version="1.0" encoding="UTF-8"?>" line, then save the file, and move onto the next XML file and so on and so on until all the XML files have been edited and then stop.
The file names for the XML's would always remain the same, so if necessary the batch file could be told to run on a specific set of file names rather than operating on a "all files in a folder" statement if that helps?
Am a total beginner with these things and have only written very basic scripts so am a bit lost with this "open/add/save" one and thought it would be simple, but even begin to understand some of the examples i can find online.
Thanks in advance!