Thanks for the code that I have pasted below.
I have also pasted the xml which doesn't look correct as it is all still on one line. Also how can I get it to write the xml to a file and not to the screen ? Also it doesn't seem to see th ^ as end of line so then to start on the next record ?
Thank you....
php code
<?php
$textfile="test.txt";
$fp=fopen($textfile,'r');
$FileContents=fread($fp, filesize ($textfile));
fclose($fp);
$FileData= explode("^ ", $FileContents);
for($i=0;$i<count($FileData);$i++)
{
$Data = explode(" | ", $FileData[$i]);
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
echo "<properties>\n";
echo " <property>\n";
echo " <property_ref>{$Data[0]}</property_ref>\n";
echo " <price>{$Data[1]}</price>\n";
echo " <location>{$Data[2]}</location>\n";
echo " <type>{$Data[3]}</type>\n";
echo " </property>\n";
echo "</properties>\n";
}
?>
xml output
<?xml version="1.0" encoding="ISO-8859-1" ?>
<properties>
<property>
<property_ref>abc123|£235,000|Hemel Hempstead|Semi-Detached ^
def456|£400,000|Hemel Hempstead|Detactched </property_ref>
<price></price>
<location></location>
<type></type>
</property>
</properties>
Test.txt
abc123|£235,000|Hemel Hempstead|Semi-Detached ^
def456|£400,000|Hemel Hempstead|Detactched ^