You can use the
text() function in your xpath to query the nodes with text values, as follows: Upsscs/EcommerceNotification/OrderReferenceFields/ReferenceField[text()]
In order to run this query in Logic Apps and work with the returned values as an array, you can use the
xpath() function: https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#xpath
From your example, that xpath should return the following nodes:
<ReferenceField id="1">79787709</ReferenceField> <ReferenceField id="2">936N5D4CPU</ReferenceField>
I hope this helps, let me know if you have any further questions.