cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinHutchcpa
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
v-bacao-msft
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
Pstork1
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.
v-bacao-msft
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.

moutinhoabreu
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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (89,344)