Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Parsing and XMl file

(0) ShareShare
ReportReport
Posted on by 174

Hi,

I am trying to parse an XML file that it stored in Sharepoint.

The file is loaded ok and when I check the first compose statement, the output is the full XML file.

However when I use xpath in a second compose step to search for a string/node the input is showing as [ ], i.e. empty.

 

Any ideas anyone, please!

  • moutinhoabreu Profile Picture
    170 on at
    Re: Parsing and XMl file

    Hi all,

     

    I've a similar situation. An XML file saved on sharepoint and i'm not able to parse it with Xpath.

    Screenshot 2021-03-02 at 00.17.31.png

     

    below an example from my xml file:

    I would like to extract some fields from the header Fiscal Year and End Date and fields from the xml body section. 

    <ns:StockFile xmlns:ns="urn:StockFile:PT_1_02" xmlns:doc="urn:schemas-basda-org:schema-extensions:documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns:StockHeader>
    <ns:FileVersion>1_02</ns:FileVersion>
    <ns:TaxRegistrationNumber>00000000</ns:TaxRegistrationNumber>
    <ns:FiscalYear>2020</ns:FiscalYear>
    <ns:EndDate>2020-12-31</ns:EndDate>
    <ns:NoStock>false</ns:NoStock>
    </ns:StockHeader>
    <ns:Stock>
    <ns:ProductCategory>M</ns:ProductCategory>
    <ns:ProductCode>341252452345</ns:ProductCode>
    <ns:ProductDescription>Care Kit Tube</ns:ProductDescription>
    <ns:ProductNumberCode>660042376824</ns:ProductNumberCode>
    <ns:ClosingStockQuantity>188.0</ns:ClosingStockQuantity>
    <ns:UnitOfMeasure>Un</ns:UnitOfMeasure>
    <ns:ClosingStockValue>2133.48</ns:ClosingStockValue>
    </ns:Stock>
    <ns:Stock>
    <ns:ProductCategory>M</ns:ProductCategory>
    <ns:ProductCode>09003NAVFW16</ns:ProductCode>
    <ns:ProductDescription>DEE NAVY</ns:ProductDescription>
    <ns:ProductNumberCode>09003NAVFW16</ns:ProductNumberCode>
    <ns:ClosingStockQuantity>1.0</ns:ClosingStockQuantity>
    <ns:UnitOfMeasure>Un</ns:UnitOfMeasure>
    <ns:ClosingStockValue>18.65</ns:ClosingStockValue>
    </ns:Stock>

     

  • Martin CPA Profile Picture
    174 on at
    Re: Parsing and XMl file

    Thanks, it was the base64tostring that I needed to incorporate.

  • Verified answer
    v-bacao-msft Profile Picture
    on at
    Re: Parsing and XMl file

    Hi @MartinHutchcpa ,

     

    Could you share a screenshot of the Flow configuration and details of expression?

    If possible, could you provide a similar xml file for us to do further testing?

     

    Please check if File content is encoded. If so, you may also need to use base64ToString() function to convert File content to a String value first.

    Also for Parse XML data, please refer to similar thread and see if it helps:

    Having-trouble-with-xPath-please-help

    Iterate-XML-with-flow

    Parse-XML-using-Microsoft-Flow

     

    Best Regards,

  • Pstork1 Profile Picture
    67,035 Most Valuable Professional on at
    Re: Parsing and XMl file

    The question is whether the output represents an XML document or just a string formatted as an XML document.  To use Xpath I think it needs to be an actual XMLDoc. Take a look at the following other post and note that in order to use XPath they encolse the output of the original Compose in an XML() function.  Are you doing something similar?

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1