$xmlRoot = $domtree->createElement("xml"); /* append it to the document created */ $xmlRoot = $domtree->appendChild($xmlRoot); $currentTrack = $domtree->createElement($tableName); $currentTrack = $xmlRoot->appendChild($currentTrack); // Extracting string row from file $expFields = explode(' ', $v); $fieldsFilter = array_filter($expFields); $strContent = $fieldsFilter[0]; $strData = $v; $locationArr = $_REQUEST['location']; $j = 1; // Get configuration record $saveConfig['confidId'] = $_REQUEST['selctconfig']; if (!empty($saveConfig['confidId'])) { $getConfig = $conversionConfiguration->getConfigurationById($saveConfig); } if ($_REQUEST['selctconfig'] != '') { $dataArrField = $getConfig['field']; $dataArrLocation = $getConfig['location']; } else { $dataArrField = $_REQUEST['field']; $dataArrLocation = $_REQUEST['location']; } // Loop through fields to render in XML file foreach ($dataArrField as $key => $value) { $locationVal = $dataArrLocation[$key]; // Spliting the string and setting in their fields if ($locationVal != '') { $nextVal = $dataArrLocation[$key + 1]; $prevVal = $dataArrLocation[$key - 1];