on 02-18-2019 10:20 AM
Hi Experts
I am trying to convert an input from a CSV file to XML in an iFlow in CPI.
Input.
OrgNo;OrgName;EmpNo;EmpName;EmpRole;EmpCell;EmpEmail
10001;TSB;20001;Jack Bones;Developer;481451;jb@csv.com
10001;TSB;20002;Martha Jackson;Analyst;445512;mj@csv.com
10002;Appletic; 20003;John Graham;Tester;885546;jg@xml.com
Expected Output:
<CSV_Organization>
<Organization>
<OrgNo>10001</OrgNo>
<OrgName>TSB</OrgName>
<Employee>
<EmpNo>20001</EmpNo>
<EmpName>Jack Bone</EmpName>
<EmpRole>Developer</EmpRole>
<EmpCell>481451</EmpCell>
<EmpEmail>jb@csv.com</EmpEmail>
</Employee>
</Organization>
<Organization>
<OrgNo>10001</OrgNo>
<OrgName>TSB</OrgName>
<Employee>
<EmpNo>20002</EmpNo>
<EmpName>Martha Jackson</EmpName>
<EmpRole>Analyst</EmpRole>
<EmpCell>445512</EmpCell>
<EmpEmail>mj@csv.com</EmpEmail>
</Employee>
</Organization>
<Organization>
<OrgNo>10002</OrgNo>
<OrgName>Appletic</OrgName>
<Employee>
<EmpNo>20003</EmpNo>
<EmpName>John Graham</EmpName>
<EmpRole>Tester</EmpRole>
<EmpCell>885546</EmpCell>
<EmpEmail>jg@xml.com</EmpEmail>
</Employee>
</Organization>
</CSV_Organization>
The XSD file:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CSV_Organization">
<xs:complexType>
<xs:sequence>
<xs:element name="Organization" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:short" name="OrgNo"/>
<xs:element type="xs:string" name="OrgName"/>
<xs:element name="Employee">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:short" name="EmpNo"/>
<xs:element type="xs:string" name="EmpName"/>
<xs:element type="xs:string" name="EmpRole"/>
<xs:element type="xs:int" name="EmpCell"/>
<xs:element type="xs:string" name="EmpEmail"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
When I check the payload after conversion, The Only the inforamation passed through is the organisation fields, nothing is passed for the employee.
May please assist on how I could go about in achieving such an output.
Thanks
Muzi
Hi,
Use this in xsd in csv to xml converter.
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CSV_Organization">
<xs:complexType>
<xs:sequence>
<xs:element name="Organization">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:byte" name="OrgNo"/>
<xs:element type="xs:string" name="OrgName"/>
<xs:element type="xs:byte" name="EmpNo"/>
<xs:element type="xs:string" name="EmpName"/>
<xs:element type="xs:string" name="EmpRole"/>
<xs:element type="xs:byte" name="EmpCell"/>
<xs:element type="xs:string" name="EmpEmail"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
and after that do a small mapping
then u will get the desire output
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.