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
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!

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    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?

  • Verified answer
    v-bacao-msft Profile Picture
    on at

    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,

  • Martin CPA Profile Picture
    174 on at

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

  • moutinhoabreu Profile Picture
    170 on at

    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>

     

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

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard