MuleSoft Associate Development Fundamental Practice Test

Access More Questions
Which of the following is a valid XML root expression when using DataWeave 1.0 with output application/xml?
Correct Answer:
user: { fname: "John", lname: "Doe" }
Explanation:
DataWeave 1.0 XML output requires a single root element, defined by the top-level key followed by a colon and a map of its children. The structure rootName: { ... } tells DataWeave to create an XML document with a root element named rootName, whose child elements come from the keys inside the nested map. In this example, using user as the root yields a single element containing John and Doe, which is a valid XML with one root. The other forms would not produce a single root element. If you had multiple top-level keys, you’d end up with multiple root elements, which XML does not allow. A literal XML string shown is not the DW root expression that generates XML from a data structure.

Access more questions from this quiz

Continue to MuleSoft Associate Development Fundamental Practice Test for more practice questions and the full quiz experience.

Access More Questions