Question

My xml parser is runing into an error when I try to parse the attached csv I think is because of the three commas before the description, I clean the file manually and leave only 1 comma and it work. I there any way I can identify the extram commas and get ride of the with the csv2xml parser php file ?

files attache in zip format

Thank you

Question

My xml parser is runing into an error when I try to parse the attached csv I think is because of the three commas before the description, I clean the file manually and leave only 1 comma and it work. I there any way I can identify the extram commas and get ride of the with the csv2xml parser php file ?

files attache in zip format

Thank you

You could run the csv file through preg_replace_all() and have the redundant commas removed.

eg:

$txt = preg_replace("/,+/", ',', $txt);

Seems to me that the function that parses the CSV to XML is ok, only the CSV file is malformed since it defines only 3 columns in the first row but has more then three columns of data in some of the subsequent rows (the extra commas).