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 Automate
Suggested Answer

XPath query

(1) ShareShare
ReportReport
Posted on by 8
Hi all,
 
I'm pretty much new to Power Automate, so still learning it's features. I wanna read an xml file and get the response of a certain "field". My xml looks like this and I want to get the "DNI":
 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <ExponerInfoPacResponse xmlns="http://tempuri.org/">
      <ExponerInfoPacResult xmlns:a="URLFlorence">
        <a:HasError>false</a:HasError>
        <a:Message i:nil="true" />
        <a:Listado>
          <a:clsPacientesExponerInfoDTO>
            <a:CodAseguradora>00145</a:CodAseguradora>
            <a:CodColectivo>00261</a:CodColectivo>
            <a:DNI>10397501</a:DNI>
            <a:DescripcionAseguradora>C. SANIDAD</a:DescripcionAseguradora>
            <a:DescripcionColectivo>OTROS DPTOS</a:DescripcionColectivo>
            <a:FechaNacimiento>1959-09-23T00:00:00</a:FechaNacimiento>
            <a:OtrosID />
            <a:TipoOtrosID />
            <a:Verificado>true</a:Verificado>
          </a:clsPacientesExponerInfoDTO>
        </a:Listado>
      </ExponerInfoPacResult>
    </ExponerInfoPacResponse>
  </s:Body>
</s:Envelope>
 
Would anyone help me on how to get the XPath query to reach that point?
 
Thank you in advance :)
I have the same question (0)
  • Suggested answer
    Expiscornovus Profile Picture
    33,830 Most Valuable Professional on at
    You can use the local name of the element, in this case DNI.
     
    //*[local-name()="DNI"]/text()
     
    Below is an example with a couple of Compose actions.
    Btw, your xml is missing the i namespace, that's why I removed it from test example. The xml function complained about that namespace missing.
     
    first(xpath(xml(outputs('Compose')), '//*[local-name()="DNI"]/text()'))


    Test run of the flow
     
     
     
     
     
  • GS-27080719-0 Profile Picture
    8 on at
    Hi, first of all, thanks a lot for your response and time. I might be too noob with this, but I'm using PA Desktop and I don't have the compose option. Also, adding this doesn't bring me anything:
    //*[local-name()="DNI"]/text()
     
    On the other hand, what is "the i amespace"?
     
    Thank you again :)
     
     
     
  • Suggested answer
    Expiscornovus Profile Picture
    33,830 Most Valuable Professional on at
    Apologies, I thought you were using cloud flows instead of desktop flows.

    In that case try the below instead with an Execute Xpath expression action.
     
     
    Btw, this is the i namespace part I removed from the xml.
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard