【发布时间】:2021-03-29 12:21:35
【问题描述】:
我在为以下有效负载编写数据编织表达式时看到以下错误。如何解决这个问题(所有 XML 格式)?
XML 文件:
<Interactions
xmlns="urn:astrazeneca:na:Activity:domain:3"
xmlns:ns0="urn:astrazeneca:na:Activity:domain:3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
SchemaVersion="3.1">
<ns0:Interaction>
<InteractionDetails CreatedOnDate="2020-01-07T00:40:38"
RecordCompanyCode="AZN"
RestrictionGroup="NONE"
UpdatedOnDate="2020-01-07T00:40:39">
<StartDate>2020-01-07T00:40:18</StartDate>
<EndDate>2020-01-07T00:40:18</EndDate>
<Location xsi:type="LocationAddress">
<AddressLine LineNo="1">6089 N 1ST ST STE 102</AddressLine>
<CityName>FRESNO</CityName>
</Location>
<RelatedInteraction>
<RelationshipType>is_a_child_of</RelationshipType>
</RelatedInteraction>
</InteractionDetails>
</ns0:Interaction>
</Interactions>
表达式:
%dw 2.0
output application/xml
---
"Interactions" : payload.Interactions mapObject {
"Interaction" : $ mapObject {
"InteractionDetails" : $ mapObject {
"Location" : $ - "AddressLine"
}
}
}
错误:
You called the function '-' with these arguments:
1: String ("2020-01-07T00:40:18")
2: String ("AddressLine")
【问题讨论】:
-
你误解了
mapOjbect的目的。我建议您阅读文档:docs.mulesoft.com/mule-runtime/4.3/dw-core-functions-mapobject -
所提供的输入的预期输出是什么?