cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
manjotsingh057
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
v-xida-msft
Community Support
Community Support

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

5 REPLIES 5
ScottShearer
Super User III
Super User III

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

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  ?

  

 
v-xida-msft
Community Support
Community Support

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

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.

Abi111
New Member

Please try this. I require to parse a bunch of metadata information from an XML file and populate it into a SharePoint list.

XML file

<xml>
<settings>
<name>aaa</name>
<address>1234 Street</address>
<RequestType>Regular</RequestType>
</settings>
</xml>
PowerAutomate

 

Abi111_0-1608082962315.png

Parse xpath - xpath(xml(outputs('XML_File')), 'string(//RequestType)')

Initialize the variable from the previous Parse step
 
Initialize.png

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,985)