Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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 ( #169041=note: print w/ replies, xml ) Need Help??


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

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.


Comment on Re: Re: XML for databases?!?! Is it just me or is the rest of the world nutz?
Re: Re: Re: XML for databases?!?! Is it just me or is the rest of the world nutz?
by dsheroh (Parson) on May 24, 2002 at 13:53 UTC
    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.
        One method call, validate().

        And what, in the absence of a DTD, is the XML validated against? Simply that the brackets are all matched and it's syntactically valid? That's the same level of "validation" that you get by counting the commas in each row of a CSV file. Neither one tells you whether the data is formatted appropriately for your intended use.

Re: Re: Re: XML for databases?!?! Is it just me or is the rest of the world nutz?
by one4k4 (Hermit) on May 24, 2002 at 14:14 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2014-09-21 23:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls