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.) | [reply] |
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!
| [reply] |
| [reply] |
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.
| [reply] |
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.
| [reply] |
| [reply] |