Author Topic: XML + Databases  (Read 3342 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
XML + Databases
« 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 :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: XML + Databases
« Reply #1 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
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: XML + Databases
« Reply #2 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.

Shockwave ^ Codigos
Challenge Trophies Won:

Offline Xetick

  • Atari ST
  • ***
  • Posts: 132
  • Karma: 80
    • View Profile
    • Plane9
Re: XML + Databases
« Reply #3 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
  • All string are always wrapped in " characters
  • decimal numbers use .
  • Separator is ,
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.
Plane9 - Home of the Plane9 3d screensaver/music visualizer
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: XML + Databases
« Reply #4 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.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: XML + Databases
« Reply #5 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).
raizor

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: XML + Databases
« Reply #6 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+
Shockwave ^ Codigos
Challenge Trophies Won: