Overlooked the fact that the XML was referring to images. I created a small example based on Node-RED techniques.
The flow reads an xml file and converts this to JSON. This allowed me to iterated over the array with image names using the “split” node (loop)
After the split I’m constructing the full path and read the svg data. A “change” node was used to do a simple find & replace action for hex values. After this the flow overwrites the svg data. The split node generates a sequence of msg objects, one for each entry in the array. The “join” merges things back to a single msg object after which the flow continues as normal.
Happy to schedule a meeting.
Erik
PS. Note that xml to json conversion can be configured via msg.options (this module uses xml2js). I set a few options to copy the attribute names holding the image names to a property. This makes it easier to access the data in other nodes.
The flow (hope it survives the pastboard ;)):
[{"id":"d0883d81f425af08","type":"inject","z":"883c72d4e34706f9","name":"","props":[{"p":"workspace","v":"C:\\workspace\\support\\hessler\\svg\\","vt":"str"},{"p":"filename","v":"msg.workspace & \"images.xml\"","vt":"jsonata"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":2880,"wires":[["df437b1c6f3f65ed"]]},{"id":"df437b1c6f3f65ed","type":"file in","z":"883c72d4e34706f9","name":"","filename":"filename","filenameType":"msg","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":280,"y":2880,"wires":[["0fcca3b8c9732de0"]]},{"id":"d6c10c86cd738389","type":"debug","z":"883c72d4e34706f9","name":"debug 156","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1190,"y":2980,"wires":[]},{"id":"bddd8f583a8c79d3","type":"change","z":"883c72d4e34706f9","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.images.img","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":2880,"wires":[["d1eda2044d4de4f9"]]},{"id":"d1eda2044d4de4f9","type":"split","z":"883c72d4e34706f9","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":270,"y":2980,"wires":[["1b84ca45b9dde493"]]},{"id":"0fcca3b8c9732de0","type":"change","z":"883c72d4e34706f9","name":"xml conversion options","rules":[{"t":"set","p":"options","pt":"msg","to":"{\"explicitArray\":false,\"mergeAttrs\":true}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":2880,"wires":[["fa938a8592b83e09"]]},{"id":"fa938a8592b83e09","type":"xml","z":"883c72d4e34706f9","name":"","property":"payload","attr":"","chr":"","x":630,"y":2880,"wires":[["bddd8f583a8c79d3"]]},{"id":"e3c2332fae8d0d28","type":"file in","z":"883c72d4e34706f9","name":"","filename":"svg","filenameType":"msg","format":"utf8","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":560,"y":2980,"wires":[["26c1e584e32f5f79"]]},{"id":"1b84ca45b9dde493","type":"change","z":"883c72d4e34706f9","name":"","rules":[{"t":"set","p":"svg","pt":"msg","to":"msg.workspace & msg.payload.name","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":2980,"wires":[["e3c2332fae8d0d28"]]},{"id":"26c1e584e32f5f79","type":"change","z":"883c72d4e34706f9","name":"find & replace colors","rules":[{"t":"change","p":"payload","pt":"msg","from":"#ED2024","fromt":"str","to":"#DCD0FF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":2980,"wires":[["7da7e79dd579e4a4"]]},{"id":"7da7e79dd579e4a4","type":"file","z":"883c72d4e34706f9","name":"","filename":"svg","filenameType":"msg","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"none","x":920,"y":2980,"wires":[["ca0f663f9ebf67ce"]]},{"id":"ca0f663f9ebf67ce","type":"join","z":"883c72d4e34706f9","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1050,"y":2980,"wires":[["d6c10c86cd738389"]]},{"id":"b9468909447b6bfc","type":"comment","z":"883c72d4e34706f9","name":"Read xml with array images","info":"","x":200,"y":2800,"wires":[]},{"id":"64d450b03d33362e","type":"comment","z":"883c72d4e34706f9","name":"Convert to JSON and use split node to loop","info":"","x":240,"y":2840,"wires":[]}]