ISSUE-7

xsi:nil and minOccurs=0

State:
CLOSED
Product:
Basic
Raised by:
Jonathan Calladine
Opened on:
2006-01-12
Description:
"""
Many type serializers do not use xsi:nil and minOccurs=0 as schema designers
intend.  Given this schema type:

<xs:complexType name="UpdateMsg">
      <xs:sequence>
            <xs:element name="Name" />
            <xs:element name="Fax" minOccurs="0" nillable="true" />
      </xs:sequence>
</xs:complexType>

Callers can send message instances that either (a) include the "Fax" element
with content*, (b) exclude the "Fax" element altogether, or (c) include the
"Fax" element without content but with an xsi:nil="true" attribute.  Type
serializers, however, do not usually support scenario "b" because programming
languages can't distinguish whether a type member is intentionally NULL or just
unassigned.

Message receivers usually interpret the lack of an element as "left unsaid" and
the presence of an element with empty content and an xsi:nil="true" attribute as
"set to NULL".  Type serializers summarily convert type members with NULL values
to xsi:nil declarations, which can cause unintended data changes on the server. 

Data binding tools need to have a way to distinguish unassigned type members
(which should be ommitted from the serialization) from members assigned to NULL
(which should be serialized with xsi:nil="true").

It seems like this problem is similar to database programming.  Columns excluded
from an UPDATE statement are not summarily set to NULL - they are left
unchanged.  Maybe solutions to database binding could be reviewed for schema?

I know the whole xsi:nil / minOccurs=0 issue has been well-trodden, but I wanted
to submit this facet of the problem because there is some real pain.  Thanks!

Erik Johnson
Epicor Software Corp.

 * Assume there is a simpleType restriction in place like minLength="1"

"""

http://lists.w3.org/Archives/Public/public-xsd-databinding/2006Jan/0013.html
Related emails:
  1. ISSUE-7: xsi:nil and minOccurs=0 (from dean+cgi@w3.org on 2006-01-12)
  2. Agenda: XML Schema Patterns for Databinding Telcon 17 January 2006 (from paul.downey@bt.com on 2006-01-16)
  3. Minutes from XML Schema Patterns for Databinding call 17 January 2006 (from paul.downey@bt.com on 2006-01-18)
  4. Agenda: XML Schema Patterns for Databinding Telcon 24 January 2006 (from paul.downey@bt.com on 2006-01-23)
  5. NEW ISSUE: xs:default handling by generated types (from erikj@epicor.com on 2006-01-24)
  6. Re: NEW ISSUE: xs:default handling by generated types (from sandygao@ca.ibm.com on 2006-01-24)
  7. Re: ISSUE-7 minOccurs=0 & xsi:nil (from jon.calladine@bt.com on 2006-01-24)
  8. Re: ISSUE-7 minOccurs=0 & xsi:nil (from Paul.V.Biron@kp.org on 2006-01-24)
  9. Minutes from XML Schema Patterns for Databinding call 24 January 2006 (from paul.downey@bt.com on 2006-01-24)
  10. ISSUE-14: xs:default handling by generated types (from dean+cgi@w3.org on 2006-01-24)
  11. Re: ISSUE-7 minOccurs=0 & xsi:nil (from peter.hendry@capeclear.com on 2006-01-25)
  12. RE: ISSUE-7 minOccurs=0 & xsi:nil (from jon.calladine@bt.com on 2006-01-26)
  13. Re: ISSUE-7 minOccurs=0 & xsi:nil (from peter.hendry@capeclear.com on 2006-01-27)
  14. Agenda: XML Schema Patterns for Databinding Telcon 31 January 2006 (from paul.downey@bt.com on 2006-01-30)
  15. Re: ISSUE-7 minOccurs=0 & xsi:nil (from Paul.V.Biron@kp.org on 2006-02-02)
  16. RE: ISSUE-7 minOccurs=0 & xsi:nil (from Paul.V.Biron@kp.org on 2006-02-02)
  17. Re: ISSUE-7 minOccurs=0 & xsi:nil (from Paul.V.Biron@kp.org on 2006-02-02)
  18. Agenda: XML Schema Patterns for Databinding Telcon 7 February 2006 (from paul.downey@bt.com on 2006-02-06)
  19. Minutes from XML Schema Patterns for Databinding call 7 February 2006 (from paul.downey@bt.com on 2006-02-08)
  20. Agenda: XML Schema Patterns for Databinding F2F 27-28 February 2006 (from paul.downey@bt.com on 2006-02-22)
  21. Revised Agenda: XML Schema Patterns for Databinding F2F 27-28 February 2006 (from paul.downey@bt.com on 2006-02-27)
  22. Minutes from XML Schema Patterns for Databinding F2F 27-28 Feb 2006 (from paul.downey@bt.com on 2006-03-12)
  23. Minutes from XML Schema Patterns for Databinding call 14 March 2006 (from paul.downey@bt.com on 2006-03-14)
  24. ISSUE-7 basic patterns text (from jon.calladine@bt.com on 2006-03-24)
  25. Agenda: XML Schema Patterns for Databinding Telcon 28 March 2006 (from paul.downey@bt.com on 2006-03-28)
  26. Minutes from XML Schema Patterns for Databinding call 28 March 2006 (from paul.downey@bt.com on 2006-03-28)
  27. RE: editorial changes to Basic Patterns doc. (from paul.downey@bt.com on 2006-04-21)
  28. ISSUE-37: more than one way to express null, empty or missing content (from dean+cgi@w3.org on 2006-04-25)
  29. Minutes from XML Schema Patterns for Databinding call 25 April 2006 (from paul.downey@bt.com on 2006-04-25)
  30. RE: ISSUE-14: xs:default handling by generated types (from paul.downey@bt.com on 2006-05-04)
  31. Minutes: XML Schema Patterns for Databinding F2F August 2007 (from paul.downey@bt.com on 2007-08-08)

Related notes:

2006-03-28: closed with Jon's proposal