Hello stack overflow community,
I am using smooks in WSO2 EI 6.2.0 for converting csv to xml. I want to know if its possible to hardcode one of xml fields. For example my csv looks like this:
Name,Age,Gender
John,20,male
Helen,15,female
What I want is an xml looking like this:
<root>
<record id="1">
<Name>John</Name>
<Age>20</Age>
<Gender>male</Gender>
<Check>true</Check>
</record>
<record id="2">
<Name>Helen</Name>
<Age>15</Age>
<Gender>female</Gender>
<Check>true</Check>
</record>
</root>
But instead I have this as a result:
<root>
<record number="1">
<Name>John</Name>
<Age>20</Age>
<Gender>male</Gender>
</record>
<record number="2">
<Name>Helen</Name>
<Age>15</Age>
<Gender>female</Gender>
</record>
Here is my smooks config:
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd">
<resource-config selector="org.xml.sax.driver">
<resource>org.milyn.csv.CSVReader</resource>
<param name="fields">Name,Age,Gender</param>
<param name="rootElementName">root</param>
<param name="recordElementName">record</param>
<param name="skipLines">1</param>
</resource-config>
</smooks-resource-list>
Is it possible to add an additional xml field with a hardcoded value? Also if number can be replaced with id as I have wrote down in the xml above?