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 / Extract information fr...
Power Automate
Answered

Extract information from XML file

(0) ShareShare
ReportReport
Posted on by 8

Hello to everyone, I need for your help. I'm trying to extract some information from this xml file.

 

<?xml version="1.0" encoding="utf-8"?>
<root>
<page>
<item name="Modelo(Zonal OCR)" value="IM 550F" />
<item name="Serie(Zonal OCR)" value="3209X711378" />
</page>
<page>
<item name="Modelo(Zonal OCR)" value="" />
<item name="Serie(Zonal OCR)" value="" />
</page>
</root>

 

This file is generated trought a scan application, that extract some information by OCR, this informations is rendered in an index file in format  txt, csv or xml. With this information, i try to create a new element in a list, or update the properties into a file in a document library. But i can't obtain the information for "Modelo" or "Serie"

 I try to use the xpath function like this

"xpath(outputs('xml'),'//*[local-name()="root"]/page[1]/item[1]/@value'), but it only returns an error."
 
How i can acces the values of "Modelo" or "Serie".
Tahnks for your help
Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @apolodor0 ,

     

    Please try:

    xpath(xml(outputs('xml')), '/root/page[1]/item[1]/@value')

    vbofengmsft_0-1698114458727.png

    vbofengmsft_1-1698114481245.png

     

    Best Regards,
    Bof

     

  • apolodor0 Profile Picture
    8 on at

    Thanks a lot @v-bofeng-msft, it really works. Only one more thing, this function returns the value

    "value=\"IM 550F\""
    And when i use it to create a new element in a sharepoint list, it use the whole string
    "value=\"IM 550F\"", but i only need the string IM 550F. In Xpather, the result is only IM 550F,,
    how can obtain only the string i needed?
    So sorry, but i don't have a lot of knowledge in XML or Automate.
     
    Thanks for your help again
    Xpather.png
  • Verified answer
    Manish Solanki Profile Picture
    15,169 Moderator on at

    Hi @apolodor0 

     

    Pls use the below expression to extract the required text:

    xpath(xml(outputs('xml')), 'string(/root/page[1]/item[1]/@value)')

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @apolodor0 ,

     

    As @ManishSolanki mentioned, please try:

    xpath(xml(outputs('xml')), 'string(/root/page[1]/item[1]/@value)')

     

    Best Regards,
    Bof

  • Chriddle Profile Picture
    8,729 Super User 2026 Season 2 on at

    Also note that you can also convert XML to JSON and use the usual methods to access values:

    Chriddle_0-1698148017154.png

    json(xml(outputs('XML')))
    body('Parse_JSON')['root']['page'][0]['item'][0]['@value']

     

  • apolodor0 Profile Picture
    8 on at

    Thanks a lot, it works perfectly

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 289

#2
11manish Profile Picture

11manish 288 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard