Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Suppose an organization pays their employees on a monthly basis. The salary of each
of its employees is tallied in an XML file for each month. According to the new requirements, the
new software must perform following things:
a) If an employee is not present during a month award them zero salaries.
b) If a particular month is not present in the salary XML file, award zero salaries
for that as well.
Hi Shong,
I want to generate XML file with added data.
XML file attached with the post(Once again attached to this post). Sample is as below. In below file there are only 6 months for employee. I want add remaining months(Total 12 months) and add zero salary to those months.
<Employees>
<EMP_NAME1>K</EMP_NAME1>
<Employee>
<EMP_ID>101</EMP_ID>
<EMP_NAME>Henry Mark</EMP_NAME>
<EMP_PROJECT_ID>P123</EMP_PROJECT_ID>
<SALARY>
<YEARLY Id="2013">
<MONTHLY>
<MONTH Id="1" Sal="60000"/>268600
<MONTH Id="2" Sal="20600"/>
<MONTH Id="3" Sal="26000"/>
<MONTH Id="4" Sal="67000"/>
<MONTH Id="5" Sal="68000"/>
<MONTH Id="6" Sal="27000"/>
</MONTHLY>
</YEARLY>
<YEARLY Id="2014">
<MONTHLY>
<MONTH Id="4" Sal="80000"/>
<MONTH Id="5" Sal="12000"/>
<MONTH Id="7" Sal="20000"/>
<MONTH Id="8" Sal="20000"/>
<MONTH Id="9" Sal="28000"/>
<MONTH Id="10" Sal="29000"/>
</MONTHLY>
Hi
See below scenario, it creates a new XML file based on your input example XML file, it adds new monthly salary element and set salary as 0 if it is not found in the source file.
Hope it helps and let me know if you have any questions.
Regards
Shong