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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / xpath - How to loop th...
Power Automate
Answered

xpath - How to loop through each descendant to get values?

(0) ShareShare
ReportReport
Posted on by 128

Hello

I want to extract some data (text) from an XML file for later import to dataverse. I am able to retrieve the node I need and all descendants using xpath (includes children and grand children).  Is there a way to loop through the XPathResults for each descendant to get the values for each descendant?

Thanks in advance for suggestions or further readings. 

  • Verified answer
    Sandra Soniec Profile Picture
    128 on at

    The following syntax brought me one step ahead

    Retrieves all descendants that are text nodes and list them in variable XPathResult together with their tags

     

    //PARAG[@IDENTIFIER='001.006']//*[text()]

     

    Retrieves the text values of all descendent nodes and list them in variable XPath Result

     

    //PARAG[@IDENTIFIER='001.006']//text()

     

    Remaining task is to get rid on new lines if there are tags with formatting instructions in the middle of a text.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 414

#2
11manish Profile Picture

11manish 331 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard