- From: Doug <ummmmm@myrealbox.com>
- Date: Tue, 20 Jul 2004 16:03:00 -0500
- 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" minOccurs="0"/> 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? Thanks.
Received on Wednesday, 21 July 2004 17:20:56 UTC