Re: XML Schema quiz on default values

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.

HTH,

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.

/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 Friday, 24 August 2012 08:14:52 UTC