I am processing an XML document (which is HTML with text and elements nested).
Using the following script, Dataweave playground and VScode extension output the correct order of the text/elements:
%dw 2.0
output application/json skipNullOn="everywhere"
var xmlString="<root>sometext0<element1>1</element1>sometext2</root>"
---
read(xmlString, 'application/xml')
Results in the correct output order:
{
"root": {
"__text": "sometext0",
"element1": "1",
"__text": "sometext2"
}
}
However, the exact same script in Anypoint Studio(7.15, Mule 4.4.0) results in this output with the _text nodes concatenated resulting in losing the correct order:
{
"root": {
"element1": "1",
"__text": "sometext0sometext2"
}
}
Does anyone know how I can get Studio/Mule runtime to produce the same correct output as Playground/VSCode please?
Tried running in studio and vscode and playground.
The DataWeave 2.0 (BETA) extension for Visual Code and the DataWeave playground may not have the same DataWeave engine that actual Mule Runtime versions. They may have different versions of DataWeave embedded. The canonical behavior is whatever a Mule version is doing.
If a Mule version doesn't meet your expectations and you are a customer you coukd open a bug to MuleSoft.