Default values vs. validation

Section 1.1 in the XML Schema Structures WD says:

-----
The purpose of an XML Schema: Structures schema is to define and
describe a class of XML documents by using schema components to
constrain and document the meaning, usage and relationships of their
constituent parts: datatypes, elements and their content and
attributes and their values.
         
Schemas may also provide for the specification of additional document
information, such as default values for attributes and elements.
-----

I consider this as two different purposes, and I don't think it's a
good idea to mix them together as the schema WD does (DTDs has the
same problem). The inclusion of default values in the schema lead to
that the output of parsing the same XML document with and without the
schema can be different, and I don't like that. I think that
validation and supplying default values should be clearly separated
processing steps. Likewise, I think that the schema for validation
and the defintion for default values should be clearly separated data
entites. It should be possible to apply default values without
validation, and omitting the validation step should not affect the
result for valid input.

My suggestion is to remove default values, and everything else that
may cause the output from validating and non-validating parsing to be
different, from the XML Schema spec and leave that for some other
mechanism (perhaps internal DTD subset for attribute value defaults).

Best Regards
Mikael

Received on Monday, 17 April 2000 06:13:27 UTC