Power Community

Power Community

4 new undocumented functions to encode and decode Xml in Power Automate

Today, I found 4 new undocumented functions in Power Automate

  • encodeXmlValue()
  • decodeXmlValue()
  • encodeXmlName()
  • decodeXmlName()

Why Encode Xml?

First of all, why would we need to encode xml? Sometimes characters in the xml could cause problems when you use them in an actions. Encoding characters can then typically solve this issue.

Typically you would treat the tags in xml differently from the actual data. In the example below. We would potentially want to encode the the ‘data with a space’ tag.

Some data that I have here & some more 'data'

So what does Power Automate offer us.

Within recent Logic Apps release notes I found the functions mentioned earlier. And as Power Automate is built on Logic Apps these functions should work in Power Automate too.

Example Xml

In my examples below I’ve created a flow that has a Compose step with some xml. I’ve renamed this Compose step to MyXml.

4 new undocumented functions to encode and decode Xml in Power Automate Microsoft Office 365 image 7

EncodeXmlValue

Then within Power Automate I’m adding another Compose action with the following expression

EncodeXmlValue(outputs('MyXml'))
EncodeXmlValue

I now get the following result

4 new undocumented functions to encode and decode Xml in Power Automate Microsoft Office 365 image 9

DecodeXmlValue

And then when we decode the above output we will get out original xml data back.

DecodeXmlValue(outputs('EncodeXmlValue'))
DecodeXmlValue

EncodeXmlName

As mentioned earlier, there is a second method of encoding available within Xml. You might recognise this from URL in your browsers as well. Typically URLs in browsers will use the same escape characters as these 4 function use.

EncodeXmlName(outputs('MyXml'))
EncodeXmlName

DecodeXmlName

Then finally we can decode using the DecodeXmlName function.

DecodeXmlName(outputs('EncodeXmlName'))
DecodeXmlName

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Adjusting the time zone in Power BI DAX – Quick Tip

Hi Folks, Here is the use case, I was actually pulling data from Model Driven App. As I was testing...

More Articles Like This

- Advertisement -spot_img