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

Re: XML Schema quiz on default values

From: Pete Cordell <petexmldev@codalogic.com>
Date: Fri, 24 Aug 2012 09:14:04 +0100
Message-ID: <FE7732C29D5C479388342B489AC662DB@codalogic>
To: "Costello, Roger L." <costello@mitre.org>, <xmlschema-dev@w3.org>
Hi Roger,

But the issue is not whether the empty string is valid or not for the 
relevant type, but simply whether it's empty.  Translating the paragraph 
that Ken mentioned into something more intelligible you get:

...In particular, an element with a
   [default value] whose simple type definition
   includes the empty string in its lexical space will
   nonetheless never receive that [empty string] value,
   because the [default value] will override it.


Pete Cordell
Codalogic Ltd
Twitter: http://twitter.com/petecordell
Interface XML to C++ the easy way using C++ XML
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
for more info
----- Original Message ----- 
From: "Costello, Roger L." <costello@mitre.org>
To: <xmlschema-dev@w3.org>
Sent: Friday, August 24, 2012 12:51 AM
Subject: Re: XML Schema quiz on default values

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.


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

Michael Kay
Received on Friday, 24 August 2012 08:14:52 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:20 UTC