cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper III
Helper III

Parsing and XMl file

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Dual Super User III
Dual Super User III

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?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Community Support
Community Support

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,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

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

Advocate IV
Advocate IV

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>

 

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (44,751)