I need to call a webservice from a flow, which only accepts XML. I have a MS Form which acts as input for this webservice.
Since it only accepts XML I need to escape some characters so the flow does not post invalid XML data.
For example a user inputting "Hello to you & world" would break the webservice because of the '&'.
I tried using URIEncode and other methods, but came up empty.
My solution is to use multiple replace statements to replace all invalid XML characters:
replace(replace(replace(replace(replace(outputs('YourOutput'),'&', '&'), '<', '<'), '>', '>'), '"', '"'), '''', ''')
Are there any (cleaner) alternatives? I would hate to add this expression every time I have some kind of user input.

Report
All responses (
Answers (