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

Re: xsi:nil and identity constraints

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 25 Jul 2003 09:42:46 +0100
Message-ID: <1111549209805.20030725094246@jenitennison.com>
To: "Tim Hanson" <Timothy.Hanson@bea.com>
CC: xmlschema-dev@w3.org

Hi Tim,

> 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.

I agree that it could do with some clarification. You should write to
www-xml-schema-comments@w3.org to say so.

The way I read Validation Rule: Identity-constraint Satisfied (in
3.11.4 Identity-constraint Definition Validation Rules [1]), I think
that your instance is invalid due to Clause 3, which states:

 "For each node in the Ětarget node setĚ all of the {fields}, with
  that node as the context node, evaluate to either an empty node-set
  or a node-set with exactly one member, which must have a simple

In your schema, the <uid> element is declared with the default type of
xs:anyType, which is a complex type. The first <uid> element in your
instance document overrides this type with an xsi:type attribute, but
the second <uid> element doesn't, so it has a complex type. Therefore
the instance is invalid because the second <uid> element doesn't have
a simple type.

Indeed, this is the error that Xerces-J gives for this example. If the
<uid> element is declared with the type xs:anySimpleType then Xerces-J
says that your example is valid. On the other hand, MSXML says that
it's invalid, and I can't see any wording in the spec that would
exclude elements with xsi:nil="true" from the qualified node set
that's used to judge whether the identity constraint has been met.



[1] http://www.w3.org/TR/xmlschema-1/#section-Identity-constraint-Definition-Validation-Rules

Jeni Tennison
Received on Friday, 25 July 2003 04:50:12 UTC

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