Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: Shockwave on March 08, 2011

Title: XML + Databases
Post by: Shockwave on March 08, 2011
This has no relevance to demos at all or effects of any kind.  In work I am at the beginning stage of a new project to pass data from one kind of system into another one.  Without revealing anything that could get me in trouble with my company, I will need to run an extract on one system and hand the extract over to another team who will worry about including it on thier system, or maybe I'll even be doing the transfer myself..

Anyway I thought about making a .CSV extract and also thought about turning it into XML.  I was just wondering whether anyone here has any opinions on which technique would be the strongest method.

There would be large amounts of data to move, unfortunately I won't be able to give you any information about the systems I use at work or even what the project is for, I'm just after a straight XML v/s CSV comparison..

Cheers :)
Title: Re: XML + Databases
Post by: Jim on March 08, 2011
XML every single time.  It's a standard that everyone can support.  There's no standards for csv, not even the fact that commas separate the values.
There are lots of libraries for XML, try to avoid writing your own that just uses strings.  What language are you coding in?

Jim
Title: Re: XML + Databases
Post by: Shockwave on March 08, 2011
I'm possibly going to be using Visual Basic, but the project has a tight deadline and I may not bother with VB because the system I am getting the data off has it's own embedded (and archaic) programming language that I can use to create the XML manually.

Title: Re: XML + Databases
Post by: Xetick on March 08, 2011
Since you talk about databases and thus probably a flat structure and lots of data (I assume 100's of megabytes) I would go with csv. Just define the format to use before hand. Any rules would do, just make sure they are defined before you start. Example
CSV can also much more easily be stream read. XML files are a bit tricker to do that with since you need to find the close tag of the elements. Since you dont want to read in a 500Mb xml file in memory before you start to import it into your target system.

But if this wasn't a large amount of data I would go with XML. With one element per row and each column as an attribute. To keep the size somewhat reasonable.
Title: Re: XML + Databases
Post by: Shockwave on March 08, 2011
But if this wasn't a large amount of data I would go with XML. With one element per row and each column as an attribute. To keep the size somewhat reasonable.

I think I'll be dealing with files of several MB, but probably not hundreds of MB to be honest.

Sorry to be vague, it's difficult to reveal more information because I could get in trouble if the wrong person read this post.
Title: Re: XML + Databases
Post by: Raizor on March 09, 2011
Normally I'd go with Jim and say XML but it sounds like you're having to write an exporter on the source system manually, so csv will probably be the quickest and easiest route to success in this instance. Xetick makes good points about escaping the data too, be careful with that if using csv (or XML depending on the data).
Title: Re: XML + Databases
Post by: Shockwave on March 09, 2011
Thanks Raizor, Jim and xetick.  I was thinking that csv would be easier but instinctively I was drawn towards xml.  I may end up using csv and changing it when the project is in place. Anyway k+