0

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

2
Contributors
1
Reply
3
Views
9 Years
Discussion Span
Last Post by digital-ether
0

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).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.