Take the 2-minute tour ×  I'm wondering if there is an accepted
method to convert a tab delimited text file to XML, so that it
can be imported in Adobe Flex. I would prefer to use PHP to
achieve this.    The tab delimited text file I am looking to
convert is in the format  Refnumber  Location    Name     Age
123        North America    Steve    32     And I am looking to
convert to  <refnumber> 123 </refnumber>  <location> North
America </location> <name> Steve </name> <age> 32 </age>
share|improve this question Can you post the contents of the
TAB-DELIMITED-TEXT-FILE for reference. –  Sujit Agarwal May 26
'11 at 16:08  3 Answers 3  up vote 4 down vote accepted  You can
iterate the file line by line and write the contents with
XMLWriter  XmlWriter Example (demo)  $xmlWriter = new
XMLWriter(); $xmlWriter->startDocument('1.0', 'UTF-8');
$tsvFile = new SplFileObject('filename.tsv'); foreach ($tsvFile
as $line => $row) {     if($line > 0) {
$xmlWriter->writeElement('refnumber', $row[0]);         $xml