W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

default values - a best practice?

From: Paul Kiel <paul@hr-xml.org>
Date: Thu, 27 Feb 2003 08:28:56 -0500
Message-ID: <002001c2de64$2daca420$6401a8c0@pkiel2>
To: <xmlschema-dev@w3.org>

I have been having a debate recently with a few colleagues about the role of default values in a schema.  My view was that they should not be used in a schema.  The reasons are basically two fold.  First, default values in a schema mix data (the instance) with metadata (the schema).  From a design point of view, I want to keep these things separate.  Secondly, it creates a situation where an xml instance does not contain all the data.  As is so often the fact, implementers program to an instance rather than a schema (not necessarily correct, but it is reality) and default values are excluded.  Also something that is the fact (again not necessarily correct), is that once two trading partners develop a confidence in their connects, they turn off validation - thus the code must support the default values which they don't get from the schema.  (This last item is not a big driver, but worth mentioning nevertheless.)

Some of my colleagues were of course of the other opinion, mostly around the fact that default values allow as much information to be known ahead of time so one can plan for it.  They additionally say it lightens up the file size - but I don't think this is a significant driver (unless they are heavily used).

What do you think - are default values in a schema a good best practice?

Paul Kiel

W. Paul Kiel
HR-XML Consortium
Received on Thursday, 27 February 2003 08:26:01 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:09 UTC