Skip to Content
0
Nov 28, 2019 at 10:40 AM

How to Split Single xml file( Contains two separate xml structures) into multiple xml files

4715 Views

Hi Team,

I have following requirement to split xml into two xml files. Is there any xslt/java mapping approach to split xml like below from single to two target xmls.

Input: in single file have two xml structures.

<?xml version="1.0" encoding="utf-8"?>

<Permanentemployees>

<employee >

<firstname>Jane</firstname>

<title>Engineer</title>

........

</employee>

</Permanentemployees>

<?xml version="1.0" encoding="utf-8"?>

<Contractemployees>

<employee >

<firstname>Jane</firstname>

<title>Engineer</title>

.........

</employee>

</Contractemployees>

Target Xml's:

---------------

OutPut1:

<?xml version="1.0" encoding="utf-8"?> <Permanentemployees> <employee > <firstname>Jane</firstname> <title>Engineer</title> ........ </employee> </Permanentemployees>

Output2:

<?xml version="1.0" encoding="utf-8"?> <Contractemployees> <employee > <firstname>Jane</firstname> <title>Engineer</title> ......... </employee> </Contractemployees>