cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
acrespo
Regular Visitor

Parse XML to return first node

Any ideas on how to extract the first node or category of an XML file? I assume xpath is the way to go but not sure what to put in the expression:

 

For the example below, I wish to extract the value: ShipmentProfileReport

Possibly something like: xpath(xml(outputs('XML File')), '??????')
 
<?xml version="1.0" encoding="utf-8"?>
</ShipmentProfileReport>
  <ShipmentProfileReportItem>
    <JobOperator>John Doe</JobOperator>
     <Master>17231888581</Master>
  </ShipmentProfileReportItem>
  <ShipmentProfileReportItem>
    <JobOperator>Jane Doe</JobOperator>
    <Master>78423082032</Master>
  </ShipmentProfileReportItem>
</ShipmentProfileReport>

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @acrespo,

 

xml() function and xpath() function neither of them can do it.

As a workaround, you could use split() function and index to approach that:

split(split(outputs('XML'),'<')[2],'>')[0]

Screenshot 2021-02-27 095241.jpg

Run result:

Screenshot 2021-02-27 095206.jpg

 

Best Regards,
Community Support Team _ Lin Tu
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

1 REPLY 1
v-litu-msft
Community Support
Community Support

Hi @acrespo,

 

xml() function and xpath() function neither of them can do it.

As a workaround, you could use split() function and index to approach that:

split(split(outputs('XML'),'<')[2],'>')[0]

Screenshot 2021-02-27 095241.jpg

Run result:

Screenshot 2021-02-27 095206.jpg

 

Best Regards,
Community Support Team _ Lin Tu
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

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.

Users online (12,594)