[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: csv to xml converter bug

Subject: Re: csv to xml converter bug
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 10 Jul 2007 15:54:42 +0100
Re:  csv to xml converter bug
On 7/10/07, mcburton <mcburton@xxxxxxxxx> wrote:
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.

There's a rule I follow - "when you feel like using a delimeter - don't"

"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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.