我是 Mule 的新手,所以请耐心等待。我收到以下 CSV 文件:
Company1,2,123 Street,Winchester,UK
"000010","CHRISTINE","I","HAAS","A00","3978","1995-01-01","PRES",18,"F","1963-08-24",152750.00
"000020","MICHAEL","L","THOMPSON","B01","3476","2003-10-10","MANAGER",18,"M","1978-02-02",94250.00
第一行,标题,包含公司信息以及 CSV 文件中的记录数(员工人数)(标题中的第二个参数)。
现在我需要将其转换为以下 XML:
<?xml version="1.0" encoding="UTF-8"?>
<tns:employeedata xmlns:tns="http://coxb.test.legstar.com/payrollemployee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://coxb.test.legstar.com/payrollemployee PayrollEmployee.xsd ">
<tns:employeecount>2</tns:employeecount>
<tns:employeelist>
<tns:employees>
<tns:employeenumber>000010</tns:employeenumber>
<tns:firstname>CHRISTINE</tns:firstname>
<tns:middleinitial>I</tns:middleinitial>
<tns:surname>HAAS</tns:surname>
<tns:department>A00</tns:department>
</tns:employees>
<tns:employees>
<tns:employeenumber>000020</tns:employeenumber>
<tns:firstname>MICHAEL</tns:firstname>
<tns:middleinitial>L</tns:middleinitial>
<tns:surname>THOMPSON</tns:surname>
<tns:department>B01</tns:department>
</tns:employees>
</tns:employeelist>
</tns:employeedata>
我可以在没有第一行(标题)的情况下轻松转换此文件。我的问题是如何处理标题和提取/转换“employeecount”。
任何帮助将不胜感激。