Example - Split Element is a Subelement
In this example, the split element is a subelement, <country>, which is a part of the <Employee> element.
<?xml version="1.0" encoding="ISO-8859-1"?> <Employees> <Employee> <name>Josephine Foller</name> <department>Marketing</department> <country>USA</country> <employ-type>Permanent</employ-type> <year>1985</year> </Employee> <Employee> <name>Kris Amigon</name> <department>Marketing</department> <country>UK</country> <employ-type>Permanent</employ-type> <year>1997</year> </Employee> <Employee> ............. ............. <Dept> <name>Marketing</name> <country>UK</country> </Dept> </Employees>
The fragments created contain the <country> element from the <Employee> element as well as the <Dept> element.
<?xml version="1.0" encoding="ISO-8859-1"?> <Employees> <Employee> <name>Josephine Foller</name> <department>marketing</department> <country>usa</country> ............. <country>UK</country> </Employee> </Employees>
If you want the fragment to contain only the repeating elements from the <Employee> element, use two GetFragment activities.
<?xml version="1.0" encoding="ISO-8859-1"?> <Employees> <Employee> <country>USA</country> ............. </Employee> </Employees>
Use two GetFragment activities as follows:
- The first GetFragment activity splits the XML with the <Employee> element.
-
The output of the first activity is mapped to the second GetFragment activity input where the split element name is specified as /Employees/Employee/country.