[英]DataWeave XML to POJO Transformation
I am trying to transform the result of an SOAP call to a set of POJO's -the following is an example of what my existing XML looks like and the transformation I am trying to apply. 我正在尝试将SOAP调用的结果转换为一组POJO - 以下是我现有XML的样子以及我尝试应用的转换的示例。
<?xml version="1.0" encoding="UTF-8"?>
<orders>
<order>
<StoreID />
<Total>false</Total>
<IndividualEntry>
<Number>8</Number>
<DeliverCharge>30.0</DeliverCharge>
</IndividualEntry>
<IndividualEntry>
<Number>7</Number>
<DeliverCharge>20.0</DeliverCharge>
</IndividualEntry>
<IndividualEntry>
<Number>6</Number>
<DeliverCharge>1.0</DeliverCharge>
</IndividualEntry>
</order>
My Data Weave Transformation is as follows - as per the documentation you need to use a multi-key selector for repeated keys(in this case IndividualEntry) but how do I end up implementing that for this scenario ? 我的数据编织转换如下 - 根据文档,您需要为重复键使用多键选择器(在本例中为IndividualEntry),但我如何最终实现这种情况?
Orders: payload.orders.*order map {
StoreID : $.StoreID,
Total : $.Total,
IndividualEntry: {
Number: $.Number,
DeliverCharge: $.DeliverCharge
}
}
You can try like below 您可以尝试如下
Orders: payload.orders.*order map {
StoreID : $.StoreID,
Total : $.Total,
IndividualEntry: $.*IndividualEntry map {
Number: $.Number,
DeliverCharge: $.DeliverCharge
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.