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 Automate
Unanswered

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,189 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,189 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

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard