Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Element "default" attribute behaviour and MS .net

From: Doug <ummmmm@---------.--->
To: xmlschema-dev@--.---
Date: 7/20/2004 11:03:00 AM
----------------------------------------------------------------
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.

From george@s...  Wed Jul 21 17:51:40 2004
Return-Path: <george@sync.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent