W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2003

identity constraints and xsi:nil

From: Tim Hanson <Timothy.Hanson@bea.com>
Date: Thu, 14 Aug 2003 06:48:53 -0700
Message-Id: <5.1.0.14.1.20030814064849.02869a80@localhost>
To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>




If an element selected by the field  of an identity constraint has 
xsi:nil='true', is the value treated as missing? For example, is the 
following instance valid, given the schema.

I think this should be valid since the xsi:nil attribute on the uid 
elements would be equivalent to the elements missing for the purposes of 
identity constraints. Either way 3.11.4 of Schema part 1 could use some 
clarification around xsi:nil.

Tim



schema
------
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <xsd:element name="root">
                 <xsd:complexType>
                         <xsd:sequence>
                                 <xsd:element ref="uid" 
maxOccurs="unbounded"/>
                         </xsd:sequence>
                 </xsd:complexType>
                 <xsd:unique id="foo123" name="uuid">
                         <xsd:selector xpath=".//uid"/>
                         <xsd:field xpath="."/>
                 </xsd:unique>
         </xsd:element>
         <xsd:element name="uid" nillable="true" type="xsd:anySimpleType"/>
</xsd:schema>

instance
--------
<?xml version="1.0"?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xsi:noNamespaceSchemaLocation="idF018.xsd">
         <uid xsi:nil="true" xsi:type="xsd:string"/>
         <uid xsi:nil="true"/>
</root> 
Received on Thursday, 14 August 2003 08:49:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:09:00 UTC