Altova Mailing List Archives


Re: xsi:nil and identity constraints

From: Jeni Tennison <jeni@------------.--->
To: "Tim Hanson" <Timothy.Hanson@---.--->
Date: 7/25/2003 10:43:00 AM
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@w... 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
  type."

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.

Cheers,

Jeni

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

---
Jeni Tennison
http://www.jenitennison.com/

From nobody@w... Fri Jul 25 08:51:49 2003
Received: from wiggum.w3.org (w

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.