как получить значение типа из xml в Mule 4

<?xml version="1.0" encoding="UTF-8"?>
    <order>
       <id type="integer">4258477000</id>
       <email>[email protected]</email>
       <closed-at type="dateTime" nil="true"/>
       <created-at type="dateTime">2016-10-24T21:41:51+06:00</created-at>
       <updated-at type="dateTime">2016-10-24T21:41:52+06:00</updated-at>
    <number type="integer">19</number>
    </order>
    <Notification>
      <Id>4535etrete</Id>
      <sObject xsi:type="sf:val" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
      <sf:Programs>F Type A</sf:Programs>
</sObject>

Я хочу получить значение типа ‹sOject>, т.е. sa:val


person Sandesh    schedule 23.07.2020    source источник


Ответы (1)


Прежде всего, ваш xml недействителен. Я изменил его на следующее, чтобы предоставить вам образец.

<?xml version="1.0" encoding="UTF-8"?>
    <order xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <id type="integer">4258477000</id>
       <email>[email protected]</email>
       <closed-at type="dateTime" nil="true"/>
       <created-at type="dateTime">2016-10-24T21:41:51+06:00</created-at>
       <updated-at type="dateTime">2016-10-24T21:41:52+06:00</updated-at>
       <number type="integer">19</number>
    <Notification>
      <Id>4535etrete</Id>
      <sObject xsi:type="sf:val" xmlns:sf="urn:sobject.enterprise.soap.sforce.com">
      <sf:Programs>F Type A</sf:Programs>
     </sObject>
    </Notification>
  </order>

Сценарий DW для получения атрибута 'type' из sObject будет следующим:

%dw 2.0
output application/json
---
payload.order.Notification.sObject.@'type'
person Salim Khan    schedule 23.07.2020