cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Parse XML using Microsoft Flow

I have a SharePoint list column which contains the data in xml form.

I need to parse it and e-mail the data in tabular form.

So, Any way to parse xml data using MS Flow ?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Parse XML using Microsoft Flow

Hi @manjotsingh057,

 

Could you please share a bit more about your SharePoint list?

Could you please show a screenshot of your flow's configuration?

Further, does the UserData column store the XML data in your SharePoint list?

 

I assume that the XML data within the UserData column of your SharePoint list as below:

<?xml version="1.0"?>
<Users>
           <User1 type="System.String">Manjot Singh</User1>
</Users>

If you want to get the "Manjot Singh" from above XML data, please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Compose" action, Inputs field set to following formula:
<?xml version="1.0"?>
<Users>
           <User1 type="System.String">Manjot Singh</User1>
</Users>
  • Add a "Compose 2" action, Inputs field set to following formula:
xpath(xml(outputs('Compose')),'string(/Users/User1)')

Image reference:8.JPG

 

 

The flow works successfully as below:9.JPG

 

 

On your side, please take a try with the following formula:

xpath(xml(triggerBody()?['UsersData']),'string(//User1)')

Please take a try with above solution I provided and let me know if your issue is solved.

 

More details about Xpath function, please check the following article:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#x...

 

More details about Xpath examples, please check the following article:

https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Parse XML using Microsoft Flow

Here is a link to a post that explains how to parse XML using Flow

 

See the comments section

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Highlighted
Helper IV
Helper IV

Re: Parse XML using Microsoft Flow

Hi Scott,

 

I tried below this expression -- xpath(xml(triggerBody()?['UsersData']),'//User1') to get the user1 node from my xml.

 

but i am getting output as xml  "<User1 type="System.String">Manjot Singh</User1>" 

 

Is there any way i can get only "Manjot Singh" as output from above xml  ?

  

 
Highlighted
Community Support
Community Support

Re: Parse XML using Microsoft Flow

Hi @manjotsingh057,

 

Could you please share a bit more about your SharePoint list?

Could you please show a screenshot of your flow's configuration?

Further, does the UserData column store the XML data in your SharePoint list?

 

I assume that the XML data within the UserData column of your SharePoint list as below:

<?xml version="1.0"?>
<Users>
           <User1 type="System.String">Manjot Singh</User1>
</Users>

If you want to get the "Manjot Singh" from above XML data, please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Compose" action, Inputs field set to following formula:
<?xml version="1.0"?>
<Users>
           <User1 type="System.String">Manjot Singh</User1>
</Users>
  • Add a "Compose 2" action, Inputs field set to following formula:
xpath(xml(outputs('Compose')),'string(/Users/User1)')

Image reference:8.JPG

 

 

The flow works successfully as below:9.JPG

 

 

On your side, please take a try with the following formula:

xpath(xml(triggerBody()?['UsersData']),'string(//User1)')

Please take a try with above solution I provided and let me know if your issue is solved.

 

More details about Xpath function, please check the following article:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#x...

 

More details about Xpath examples, please check the following article:

https://msdn.microsoft.com/en-us/library/ms256086(v=vs.110).aspx

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper IV
Helper IV

Re: Parse XML using Microsoft Flow

Kris,

Thanks for this. I already implemented same way. Just 1 minor change.

Since i have multiple <User1> nodes. using 'string(//User1)' does not work for me.It gives array since output would be of array type

 

I just used '//User1' which gives me the array of <User1> nodes and then using 

"string(.)'  in next action to get current node data as text.

Helpful resources

Announcements
secondImage

August 2020 CYST Winners!

Check out the winners of the recent 'Can You Solve These?' community challenge!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Users online (3,986)