concatenate XML values using dataweave mule

一笑奈何 提交于 2020-01-16 06:41:50

问题


We have a scenario where we need to concatenate all XML node values to String.

input XML

<root>
  <line>1</line>
  <line>2</line>
  <line>3</line>
  <line>4</line>
</root>

Output to String

1234

Please let me know how can i achieve in form of String.

Thanks in advance.


回答1:


Referring DataWeave Reference Documentation at Reduce section:

Transform

%dw 1.0
%output application/json
---
concat: ["a", "b", "c", "d"] reduce ($$ ++ $)

Output

{
  "concat": "abcd"
}

Therefore, you can try something like this: concat: payload.root.*line reduce ($$ ++ $)



来源:https://stackoverflow.com/questions/35614590/concatenate-xml-values-using-dataweave-mule

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!