我在dataweava中完成了编码
%dw 1.0
%input payload application/xml
%output application/xml skipNullOn="everywhere"
---
{((payload.*Order default []) map {
Order:{
Channel:$.@EnterpriseCode,
Code:$.@OrderNo,
Status:$.@Status,
OrderLines: {
(($.OrderLines.*OrderLine default []) map {
OrderLine:{
EntryNumber:"abc",
Status:$.@Status,
(($.OrderStatuses.*OrderStatus default []) map {
ShipDate:$.@StatusDate
})
}})}
}
}
)
}
但是在将输入分配为时给出错误
<?xml version="1.0" encoding="UTF-8"?>
<Order EnterpriseCode="111" OrderNo="222" Status="Scheduled">
<OrderLines>
<OrderLine PrimeLineNo="2" Status="Shipped" OrderedQty="1000">
</OrderLine>
</OrderLines>
</Order>
这里有什么建议吗?我已经尝试过default []
,但它不起作用。分配null node
其给出错误时。我试过过滤器filter ($ != '')