How do we replace strings within an XML payload in logic apps?
input
<root>
<alexIsAwesome>yes he is</alexIsAwesome>
<bytes>sdfsdfjijOIJOISJDFQPWORPJkjsdlfkjlksdf==</bytes>
<bytes>SFSDFsdfsdgfjgjkfjsdlfkjlksdf==</bytes>
</root>
desired result
<root>
<alexIsAwesome>yes he is</alexIsAwesome>
<bytes>replacetext1</bytes>
<bytes>replacetext2</bytes>
</root>
How do we iterate through XML and replace text within nodes? Please keep in mind that the input node might be 100mb in size!
Liquidity transformation – the creation of liquid claims that are backed by illiquid assets – is a key function of many financial intermediaries.
If you already loading the XML content in you Logic App, you could just use the replace
function. Note that there are certain limits that you may end up hitting on successive runs.
If you have more complex use cases, you could instead try one of the following
For payloads up to 50MB, you could simply use the new inline code feature to perform the transformations you need. You would have to convert the payload to JSON first (using json
) and then back to XML after (using xml
).
But for much bigger payloads and/or more complex transformations, it would be best to offload this to a Function called from Logic App.
The best approach here would be to store the payload in Azure Blob Storage and your function would have a Blob Input and Blob Output binding.
You could use an Integration account with the Transform XML action, by pointing to a defined Map, either XSLT or Liquid type. logic apps enterprise integration maps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With