I am using PHPEXcel library to convert Excel files (.xls, .xlsx) to XML. I have written below code to convert Excel file to arrays. but finding issues with how to convert that array in XML format.
 <?php    
        set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
        include 'PHPExcel/IOFactory.php';
        $inputFileType = 'Excel2007';
        $inputFileNames = array('./sampleData/SamsoniteAU.xlsx');
        $objReader = PHPExcel_IOFactory::createReader($inputFileType);
        $inputFileName = array_shift($inputFileNames);
        $objPHPExcel = $objReader->load($inputFileName);
        $objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
        echo '<hr />';
        $loadedSheetNames = $objPHPExcel->getSheetNames();
        foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
            $objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
            $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
            print '<pre>';
            print_r($sheetData);
            print '</pre>';
            echo '<br /><br />';
        }
        ?>
create_header function contains the xml format I want in XML file from $sheetData array.
XML format with dummy data :
function create_header() {
                $header = '<?xml version="1.0" encoding="UTF-8"?>
            <catalog xmlns="http://www.test.com/xml/impex/catalog/2006-10-31" catalog-id="apparel-catalog">
                <product product-id="25421872">
                    <display-name xml:lang="x-default">Laptop Backpack</display-name>
                    <short-description xml:lang="x-default">Short-description</short-description>
                    <long-description xml:lang="x-default">This stylish new range is the ideal convergence between casual and contemporary. These backpacks are lightweight and ultra hard-wearing. With multiple compartments for organisation and a padded laptop protection, this practical range meets everyday business needs.</long-description>
                    <online-flag>true</online-flag>
                    <brand>test</brand>
                    <page-attributes>
                        <page-title xml:lang="x-default">Laptop Backpack</page-title>
                        <page-description xml:lang="x-default">Shop Laptop Backpack in the Official Online Store. Fast Free Standard Delivery.</page-description>
                    </page-attributes>
                </product>
            </catalog>';
                return $header;
            }
Array would be like below. My excel may have multiple values for any column.
[1] => Array
        (
            [A] => product-id
            [B] => display-name
            [C] => brand
            [D] => short-description
            [E] => long-description
            [F] => page-title
            [G] => page-description
        )
    [2] => Array
        (
            [A] => 25421872
            [B] => Laptop Backpack
            [C] => test
            [D] => >Short-description
            [E] => This stylish new range is the ideal convergence between casual and contemporary. These backpacks are lightweight and ultra hard-wearing. With multiple compartments for organisation and a padded laptop protection, this practical range meets everyday business needs.
            [F] => Laptop Backpack
            [G] => Shop Laptop Backpack in the Official Online Store. Fast Free Standard Delivery.
        )
Please help in which PHPExcel_writer I can use to generate XML file from array.
 
    