Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: XML for databases?!?! Is it just me or is the rest of the world nutz?

by Aristotle (Chancellor)
on May 24, 2002 at 05:36 UTC ( #168985=note: print w/ replies, xml ) Need Help??


in reply to XML for databases?!?! Is it just me or is the rest of the world nutz?

I shan’t say much here, because personally I don’t understand the point in using XML for plain ole tabular data either. I do see where XML is great when your data is deeply structured, and you’re dealing with arbitrary element trees. Then XML is great. But for tabular data? Storage in a ralational database and transport via CSV with column headers fill my needs quite nicely. All else is just buzzword hype, I feel. “Ooooh look ma’, XML!!”

Makeshifts last the longest.


Comment on Re: XML for databases?!?! Is it just me or is the rest of the world nutz?
Re: Re: XML for databases?!?! Is it just me or is the rest of the world nutz?
by Stegalex (Chaplain) on May 24, 2002 at 12:42 UTC
    I respectfully disagree with your opinion about there not being a point in using XML over plain CSV data because you are ignoring the fact that XML messages can be checked for well-formedness and for syntax and content before the data is accepted into your database. Some of us don't like to crap up our production databases (something to do with job security). CSV on the other hand has no built-in means of validating data so you have to hardwire all edits and validations into your code.

    I think you will find that you can't ever completely trust the person who is sending you the flat file to structure the file according to the proper business rules.

    ~~~~~~~~~~~~~~~
    I like chicken.
      XML doesn't validate itself either. It requires the use of external software to validate it. So, if you're concerned about the integrity of your database and you receive CSV data, you could just as easily write external software to validate that as well.

      (If you reply with something along the lines of "But it's easier to write a DTD and feed it through a generic validator than it is to roll your own CSV validator", please provide concrete evidence to back this up. Based on the few examples I've seen, DTDs seem to be a programming language unto themselves, no less complex (and far more verbose) than the level of perl code that would be required for this task.)

        you could just as easily write external software to validate that CVS as well

        Not quite. First if you are dealing with sloppy providers they might not include the CVS headers and then how are you going to know which field is missing when that happens?

        Then really, DTDs are written using a language designed for language description. You can't really compare it with a programing language, more with the table description part of SQL, or with lex+yacc. For a concrete evidence You can have a look at the IEEE Standards DTD (be warned though, loading the DTD crashes my Mozilla) and tell me how easy it would be to write a Perl program that would parse and validate data tagged according to that DTD (it's SGML, but XML is just the same). I know I'd rather write the DTD and let any parser do the job!

        esper++, my thoughts. You know how it is with function prototypes.. there comes a point where the compiler simply can't be clever enough to check the validity of arguments and you have to check at runtime. XML vs CSV is similar.

        Makeshifts last the longest.

        Did you actually think that I was suggesting that XML validates itself? I use XML::LibXML to do that. One method call, validate(). Sure looks easier than writing your own edits for CSV's. Face it, I am right. You are wrong.

        ~~~~~~~~~~~~~~~
        I like chicken.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://168985]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-08-27 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (253 votes), past polls