W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2012

Re: XML Schema quiz on default values

From: Costello, Roger L. <costello@mitre.org>
Date: Thu, 23 Aug 2012 23:51:52 +0000
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <B5FEE00B53CF054AA8439027E8FE17751E62FC1F@IMCMBX04.MITRE.ORG>
Hello Michael,

I am confused. The Title element is declared to be of type string, so a valid value of Title is a string of length zero, right? According to SAXON, that is the case.

/Roger

Answer: the value of Title is the empty string, not the default value.
The reason is that the empty string is a valid value of the string data
type. If you want Title to have the default value then you must
explicitly enter the default value: <Title>Hello World</Title>

WRONG. The default applies when the element is empty, not when it is
invalid.

Michael Kay
Saxonica
Received on Thursday, 23 August 2012 23:52:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 23 August 2012 23:52:24 GMT