I have a person.xml,
<?xml version="1.0" encoding="UTF-8"?>
<person>
<firstName>First Name</firstName>
<lastName>Last Name</lastName>
</person
I have person.xsd,
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="firstName" type="xs:string"/>
<xs:element name="lastName" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I need to convert it to person.csv,
firstName,lastName
First Name,Last Name
I am using Anypoint Studio 7.3 on windows 10, I am using a Listener, Read (file) xml.
See Transform Message dw below,
%dw 2.0
output application/csv separator=",", header=true
---
payload
I am getting the following message on executing the flow,
"Cannot coerce Object { encoding: UTF-8, mediaType: text/xml; charset=UTF-8, mimeType: text/xml, raw: org.mule.weave.v2.el.SeekableCursorStream@2fdc554d } ({person: {firstName: "Shahjahan",lastName: "Ravjee"}} as Object {encoding: "U...) to Array, while writing CSV at payload." evaluating expression: "%dw 2.0
output application/csv separator=",", header=true
---
payload
".
<people>
element comes from in the edit suggestion. And the GitHub link with the 20 MB zip-file (from OP's comment) has limited use too – tevemadar