;==========================================================================================================================================;; How to mass replace 'inner text' in specific keys in XML file? (1);; The 'StrIndexWild' Version.;; (c)Detlev Dalitz.20111216.;==========================================================================================================================================;-----------------------------------------------------; Ini file "Config.ini".;; [IniFilePass]; C01_01=Pass; C01_02=Pass; C01_03=Pass; C01_04=Pass; D01_02=Pass; D01_03=Not Reporting; D01_04=Not Reporting; D01_05=Pass; E01_01=Pass; E01_02=Pass; E01_03=Confidential - Not Provided; E01_04=Pass; E01_05=Pass; E01_06=Pass; E01_07=Pass; E01_08=Not Reporting - Privileged Information; E01_09=Pass; E01_10=Pass;-----------------------------------------------------; Define working folder.strFolderHome=DirScript()DirChange(strFolderHome); Define data file pathes.strFileIni=strFolderHome:"Config.ini"strFileXmlIn=strFolderHome:"Data.in.xml"strFileXmlOut=strFolderHome:"Data.out.xml"; For sure, remove existing output file.If0!=FileExist(strFileXmlOut)ThenFileDelete(strFileXmlOut); Read input xml into string variable.strXml=FileGet(strFileXmlIn); Open ini file and walk through the items.strIniSection="IniFilePass"strListItems=IniItemizePvt(strIniSection,strFileIni)intItems=ItemCount(strListItems,@TAB)ForintI=1TointItemsstrKey=ItemExtract(intI,strListItems,@TAB)strValue=IniReadPvt(strIniSection,strKey,"Pass",strFileIni)IfstrValue=="Pass"ThenContinuestrTagSearch=StrReplace("<{1}>*</{1}>","{1}",strKey);strTagReplace = StrReplace ("<{1}>### SECRET DATA ###</{1}>", "{1}", strKey) ; Adapt it to your needs, for example leave xml tag content empty.strTagReplace=StrReplace("<{1}>":strValue:"</{1}>","{1}",strKey); Adapt it to your needs, for example fill it with the value from ini file.intPos=1While@TRUEintPos=StrIndexWild(strXml,strTagSearch,intPos)IfintPos==0ThenBreakintLen=StrLenWild(strXml,strTagSearch,intPos)strXml=StrSub(strXml,1,intPos-1):strTagReplace:StrSub(strXml,intPos+intLen,-1)intPos=intPos+StrLen(strTagReplace)EndWhileNext; Write string variable to disk file.intBytesWritten=FilePut(strFileXmlOut,strXml); If this script has been called from another WB script, then return to the caller from here ...IfRtStatus()!=10ThenIfIntControl(77,80,0,0,0)>0ThenReturn; ... when not in WinBatch Studio debug mode.; Display result.ShellExecute(strFileXmlOut,"","",@NORMAL,""):CANCELExit