web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : HjFyH1p2YzMqvRWIDJP+NS
Power Automate - General Discussion
Answered

Extract information from XML file

Like (0) ShareShare
ReportReport
Posted on 24 Oct 2023 01:38:47 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
I have the same question (0)
  • apolodor0 Profile Picture
    8 on 24 Oct 2023 at 13:14:26
    Re: Extract information from XML file

    Thanks a lot, it works perfectly

  • Chriddle Profile Picture
    7,980 Super User 2025 Season 2 on 24 Oct 2023 at 11:49:42
    Re: Extract information from XML file

    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']

     

  • Verified answer
    v-bofeng-msft Profile Picture
    on 24 Oct 2023 at 07:51:58
    Re: Extract information from XML file

    Hi @apolodor0 ,

     

    As @ManishSolanki mentioned, please try:

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

     

    Best Regards,
    Bof

  • Verified answer
    ManishSolanki Profile Picture
    15,087 Super User 2025 Season 2 on 24 Oct 2023 at 04:48:18
    Re: Extract information from XML file

    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

  • apolodor0 Profile Picture
    8 on 24 Oct 2023 at 03:00:30
    Re: Extract information from XML file

    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
  • v-bofeng-msft Profile Picture
    on 24 Oct 2023 at 02:28:07
    Re: Extract information from XML file

    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

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading started
Loading complete