Lists Home |
Date Index |
Tim Bray wrote:
> Simon St.Laurent wrote:
> > Most of the documents I create personally have no schema. The data
> > model is open, defined only by the instance. The code I write for
> > processing these documents requires no schema. The code has its own
> > data model, which may or may not resemble the structure of the
> > document.
> Me too, for the frequent occurrence of cooking up an ad-hoc vocabulary
> for some particular problem. For a language that's going to be
> widely-shared, you really ought to write a schema (preferably .rnc),
> for three reasons:
> 1. It forces you to write down your design formally and exposes glaring
> in your thinking. It does for me, anyhow.
> 2. It's useful documentation, there are those who really find schemas
> easier to read than instances. Weird but true.
Do you really think that's weird, or was that humor?
Taking Atom as an example: if I want to write software
that produces or consumes it, the schema here:
<URL: http://www.tbray.org/ongoing/pie/0.2/pie02.rnc >
is infinitely more valuable than the sample instances here:
<URL: http://www.tbray.org/ongoing/pie/0.2/atom02maximal.xml >
<URL: http://www.tbray.org/ongoing/pie/0.2/atom02minimal.xml >
The sample instances leave _way_ too many questions unanswered.
Now with sufficient intuition and guesswork, you can _probably_
write software that _usually_ works _most_ of the time if all
you have by way of a specification is a collection of sample
inputs. Personally, I'd rather have a schema (RNC format,
if you please) and skip the guesswork.