Subject: Re: [xsl] csv to xml converter bug From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Tue, 10 Jul 2007 15:54:42 +0100 |
Gak! I was having the same problem last week. I have a complete hack solution:
I included leading & trailing commas in the analyze-string regex, but in the "foo,bar",,"foo,bar",x,,,"foo,bar" case I was also getting problematic parsing. Since the regex was looking for an extra comma I added it, I did a search for "," and replaced it with ",," I then spent the next 2 hours in shower cleaning off the dirty.
I gave up dirty hacks long ago (and as you've said yourself, that was a dirty hack).
Processing XML seems to suffer from hacks - probably because of the mysteries of encoding and entity resolution, but all to often I come across double escaping and odd combinations of characters put there by some well-meaning-but-oh-so-wrong programmer yet to discover forums and mailings lists (that's the vast majority in my small corner), trying to ndash and mdash to display correctly.
"Hmmm, maybe if we convert all commas inside quoted values to say, pipes |, then we could just tokenize on comma and then covert the pipes backs to commas..."
Seems kind of plausible, but will always come back to bite you in the end. (Contractors take note - you've normally left by then...)
-- http://andrewjwelch.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] csv to xml converter bug, mcburton | Thread | RE: [xsl] csv to xml converter bug, Michael Kay |
Re: [xsl] csv to xml converter bug, mcburton | Date | RE: [xsl] csv to xml converter bug, Michael Kay |
Month |