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 Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,963)