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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Kudoed Authors
Users online (1,937)