web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Escaping string to XML
Power Automate
Answered

Escaping string to XML

(0) ShareShare
ReportReport
Posted on by 3

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'),'&', '&amp;'), '<', '&lt'), '>', '&gt;'), '"', '&quot;'), '''', '&apos;')

 

Are there any (cleaner) alternatives? I would hate to add this expression every time I have some kind of user input.

AranVinkItility_0-1626293953117.png

 

 

Categories:
  • Verified answer
    eric-cheng Profile Picture
    5,171 on at

    Hi @AranVinkItility ,

     

    Have a look at this post.  Doesn't appear to have an alternative option out of the box.

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 298 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 289

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard