cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
manjotsingh057
Level: Powered On

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
Community Support Team
Community Support Team

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
Super User
Super User

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
manjotsingh057
Level: Powered On

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  ?

  

 
Community Support Team
Community Support Team

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

manjotsingh057
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (1,946)