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 expression retur...
Power Automate
Unanswered

Xpath expression returned no element (Broken??)

(0) ShareShare
ReportReport
Posted on by 1,187 Super User 2024 Season 1

Is it just me, or is the "Get XML element value" broken?

 

I have a simple test script (XML file is added as tekst at the end of this message, as the system does not allow me to attach it)

 

XML.ReadFromFile File: $'''C:\\Temp\\memometadata.xml''' Encoding: XML.FileEncoding.UTF8 XmlDocument=> XmlDocument
XML.GetXmlElementValue.GetElementValue Document: XmlDocument XPathQuery: $'''/Message/MessageHeader/Recipient/AttentionData/EMail''' TextValue=> XmlElementValue
XML.GetXmlElementValue.GetElementValue Document: XmlDocument XPathQuery: $'''/Message/MessageHeader/ContentData/CPRdata/cprNumber''' TextValue=> XmlElementValue

 

No matter what I do I get "Xpath expression returned no element"

the path is indeed correct as you can see on the screen shot

Highboy_0-1648811756059.png

Highboy_1-1648811789455.png

 

I can also get the element value using a powershell script, but would rather use the build in functionality

 

 

-------------- XML FILE BELOW (Save as c:\temp \memometadata.xml)--------------

 

<?xml version="1.0" encoding="utf-8"?><Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" memoVersion="1.1" memoSchVersion="1.1.0" xmlns="https://Somewhere.net/MeMo-1"><MessageHeader><messageType>TEST</messageType><messageUUID>fed613f0-0190-4a3a-892d-0e30dd86e9cd</messageUUID><messageID>94da662022032814115943675000</messageID><messageCode>TRANSFORMED</messageCode><label>Blablabla. Michael Martinsen</label><mandatory>false</mandatory><legalNotification>false</legalNotification><Sender><senderID>134543611</senderID><idType>CVR</idType><label>Rigspolitiet</label></Sender><Recipient><recipientID>55345226617</recipientID><idType>CVR</idType><AttentionData><AttentionPerson><label>Peter Mulla Martinsen</label></AttentionPerson><EMail><emailAddress>xxx@xxxxxxxx.xx</emailAddress></EMail><EID xmlns="https://data.gov.dk/model/core/"><eID>CVR:55606617-RID:39247535</eID></EID><UnstructuredAddress xmlns="https://data.gov.dk/model/core/"><unstructured>Holmegård Pædagog i skolen</unstructured></UnstructuredAddress></AttentionData></Recipient><ContentData><CPRdata xmlns="https://data.gov.dk/model/core/"><cprNumber>1111111111</cprNumber></CPRdata></ContentData></MessageHeader><MessageBody><createdDateTime>2022-03-28T12:12:00Z</createdDateTime><MainDocument><label>Something. Anders Martinsen</label><File><encodingFormat>application/pdf</encodingFormat><filename>Something. Anders Martinsen.pdf</filename><language>DA</language><content>YXRu8WNoZWQ=</content></File></MainDocument></MessageBody></Message>

 

I have the same question (0)
  • Rhiassuring Profile Picture
    8,692 Moderator on at

    Hi there, 

     

    It works for me (never what you want to hear, I know) -- but I had to "Read XML file" first, and then reference THAT, and then get the element value.

     

    PAD-1.PNG
    Is that something you could try out?

     

    Cheers,

     

    Rhia

  • VJR Profile Picture
    7,635 on at

    Hi @Highboy 

     

    Your xml worked but only after I removed the last attribute of the Message tag. Dont know why. Perhaps something wrong in the URL or maybe you just pasted it that way here.

     

    <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance " xmlns:xsd="http://www.w3.org/2001/XMLSchema " memoVersion="1.1" memoSchVersion="1.1.0" xmlns="https://Somewhere.net/MeMo-1 ">

     

     

    VJR_1-1648900965950.png

     

     

    VJR_2-1648901022110.png

     

    Also I added the emailAddress in the Xpath.

    Message/MessageHeader/Recipient/AttentionData/EMail/emailAddress

     

    The PAD code you have shared was only till the EMail tag.

    So check if you would need that or not.

     

     

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 223

#2
David_MA Profile Picture

David_MA 210 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 175

Last 30 days Overall leaderboard