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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Parsing XML with xpath...
Power Automate
Unanswered

Parsing XML with xpath using dynamic XML string

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I'm trying to parse an XML string value from the "text" field under "post" entity in Dynamics 365.

Here's is the sample value of the field:

 

"<?xml version="1.0" encoding="utf-16"?><pi id="Account.Create.Post" icon="0" ya="1"><ps><p type="1" otc="8" id="ff87e0f2-813f-eb11-bf68-000d3a3abbc3">David So</p></ps></pi>"

 

I'm assigning that value to a Compose step then uses another Compose (Compose 2) step to parse it using xpath

compose_2.PNG

I am trying to get the string value, David So, of the p node but I'm getting this error:

error.PNG

 

is there anything wrong with the syntax of the expression I'm using? 

I'd appreciate any feedback on this. thank you.

Categories:
I have the same question (0)
  • jinivthakkar Profile Picture
    4,187 on at

    @famcanico10 I was able to extract the information you need.

     

    jinivthakkar_0-1612350968986.png

    xpath(xml(outputs('Compose')),'string(//p)')

    Output :

    jinivthakkar_1-1612351035487.png

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

  • jinivthakkar Profile Picture
    4,187 on at

    @famcanico10 I am also facing same issue with <?xml version="1.0" encoding="utf-16"?> but if I change it to <?xml version="1.0" encoding="utf-8"?> it just works fine. So it looks some issue with the encoding tag if possible change it to utf-8 and try and it should work.

     

    I could not find any example of documentation where utf-16 was used or demonstrated, but feel free to go through below links and confirm again.

     

    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

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard