I have a file something like this:aaaa.xml content of the file is
0,<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<storeInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<s>
<BRANCH_NO>3061</BRANCH_NO>
<BRANCH_NAME>GREEN EXPRESS</BRANCH_NAME>
<STORE_TYPE>Superstore</STORE_TYPE>
</s>
</storeInformation>,<?xml version="1.0" encoding="UTF-8" standalone="yes"?><storeInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <s><BRANCH_NO>3061</BRANCH_NO><BRANCH_NAME>GREEN EXPRESS</BRANCH_NAME>NE><STORE_TYPE>Superstore</STORE_TYPE></s></storeInformation>
1,<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<storeInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<s>
<BRANCH_NO>3062</BRANCH_NO>
<BRANCH_NAME>GREEN EXPRESS</BRANCH_NAME>
<STORE_TYPE>Superstore</STORE_TYPE>
</s>
</storeInformation>,<?xml version="1.0" encoding="UTF-8" standalone="yes"?><storeInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <s><BRANCH_NO>3062</BRANCH_NO><BRANCH_NAME>GREEN EXPRESS</BRANCH_NAME><STORE_TYPE>Superstore</STORE_TYPE></s></storeInformation>
My requirement is i need to read the file line by line and write to two files
Output:
The first file should have this content
file1.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<storeInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<s>
<BRANCH_NO>3061</BRANCH_NO>
<BRANCH_NAME>GREEN EXPRESS</BRANCH_NAME>
<STORE_TYPE>Superstore</STORE_TYPE>
</s>
</storeInformation>
The second file should have this content file2.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><storeInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <s><BRANCH_NO>3061</BRANCH_NO><BRANCH_NAME>GREEN EXPRESS</BRANCH_NAME><STORE_TYPE>Superstore</STORE_TYPE></s></storeInformation>
file1 and file2 will be processed .After processing, I need to read the second line of aaaa.xml and write it in the same file1.xml and file2.xml
In the same way i need to process the entire file line by line.
Could you please help me in resolving this issue?
Thanks
Krishnakanth Manivannan