W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2004

Element "default" attribute behaviour and MS .net

From: Doug <ummmmm@myrealbox.com>
Date: Tue, 20 Jul 2004 16:03:00 -0500
Message-ID: <40FD8884.2030404@myrealbox.com>
To: xmlschema-dev@w3.org

The schema processor treats defaulted elements slightly differently. 
When an element is declared with a default value, the value of the 
element is whatever value appears as the element's content in the 
instance document; if the element appears without any content, the 
schema processor provides the element with a value equal to that of the 
default attribute. However, if the element does not appear in the 
instance document, the schema processor does not provide the element at 
all. In summary, the differences between element and attribute defaults 
can be stated as: Default attribute values apply when attributes are 
missing, and default element values apply when elements are empty.

If I read this correctly, it looks like my customer's MS .net XML 
generator is broken.  For this Schema element:

<xsd:element name="Disallowed" type="xsd:boolean" default="true" 

It generates either:

<Disallowed>false</Disallowed> when he explicitly sets his code value to 
false, or no element at all when he sets it to true.

Can anyone confirm that this is, indeed, a problem with the .net tools? 
   This URL seems to suggest that it is: 
<http://www.dotnet247.com/247reference/msgs/32/161995.aspx> , but I 
don't know anything about .net, so I could be misreading it.

Or is there some kind of code option that can change this behaviour?  Or 
a workaround to fix it?

Received on Wednesday, 21 July 2004 17:20:56 UTC

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