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 / Extracting XML values ...
Power Automate
Unanswered

Extracting XML values to array

(0) ShareShare
ReportReport
Posted on by

Hello, I need some help understanding how to extract the values on a list for <string>

 

 

 

<ModelLab>
 <Subtype>1</Subtype>
 <Symmetry>1</Symmetry>
 <Compatible>
 <string>HELLO
 </string>
 <string>HELLO2
 </string>
 <string>HELLO3
 </string>
 </Compatible>
<ModelLab>
 <Subtype>2</Subtype>
 <Symmetry>2</Symmetry>
 <Compatible>
 <string>HELLO4
 </string>
 <string>HELLO5
 </string>
 <string>HELLO6
 </string>
 </Compatible

 

 

 

 

Actually I'm using Obtain value of XML element with XPath "//ModelLabA/Compatible/string" but it only returns me one line.

I have the same question (0)
  • Verified answer
    NathanAlvares24 Profile Picture
    1,714 Moderator on at

    Hi @BernatP !

     

    I am assuming your XML is this as there is lot of missing data like I am not sure where is ModelLabA, I can see only ModelLab:

     

     

    <Root>
     <ModelLab>
     <Subtype>1</Subtype>
     <Symmetry>1</Symmetry>
     <Compatible>
     <string>HELLO</string>
     <string>HELLO2</string>
     <string>HELLO3</string>
     </Compatible>
     </ModelLab>
     <ModelLab>
     <Subtype>2</Subtype>
     <Symmetry>2</Symmetry>
     <Compatible>
     <string>HELLO4</string>
     <string>HELLO5</string>
     <string>HELLO6</string>
     </Compatible>
     </ModelLab>
    </Root>

     

     

     

    Try this flow:

    NathanAlvares24_0-1718984580693.png

     

    I have stored this in an xml file on my machine and then I am reading from this as seen in actions 2 and 3.

     

    Output:

    NathanAlvares24_0-1718984784214.png

     

    Code (copy and paste this onto your flow):

     

     

    Variables.CreateNewList List=> ListofStrings
    SET pathXML TO $'''C:\\Users\\testing.xml'''
    XML.ReadFromFile File: pathXML Encoding: XML.FileEncoding.DefaultEncoding XmlDocument=> XmlDocument
    XML.ExecuteXPathQuery.ExecuteXPath XmlDocument: XmlDocument XPathQuery: $'''Root/ModelLab/Compatible/string''' XPathResults=> XPathResults
    LOOP FOREACH CurrentItem IN XPathResults
     XML.GetXmlElementValue.GetElementValue Document: CurrentItem TextValue=> XmlElementValue
     Variables.AddItemToList Item: XmlElementValue List: ListofStrings
    END

     

     

     

    I hope this helps.

  • Deenuji_Loganathan_ Profile Picture
    6,250 Super User 2025 Season 2 on at

    @BernatP 

     

    Please describe your complete use case and provide some sample XML data, ensuring all sensitive information is obscured.

     

    From the XML data provided, it appears that there are no elements named "ModelLabA" or "ModelLabB," yet you are attempting to extract them.

     

    Therefore, please furnish more context and sample data so that further assistance can be offered on this matter.

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • BernatP Profile Picture
    on at

    Hello and thaks for the quick reply!

    It worked perfectlly and helped me so much to build the flow. Also I noticed that when I created the flow I did with the Power Fx activated and with that mode I can't see all the nodes.

     

    Now all works perfect. Thanks again.

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard