W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2002

Clarification required

From: Rahul Srivastava <Rahul.Srivastava@Sun.COM>
Date: Wed, 10 Apr 2002 14:43:42 +0000 (Asia/Calcutta)
Message-Id: <200204100921.g3A9LDF24457@blr-root.India.Sun.COM>
To: www-xml-schema-comments@w3.org

I think the following schema is invalid:

<xsd:element name="root">
      <xsd:element name="Book" maxOccurs="unbounded">
            <xsd:element name="isbn" type="xsd:string"/>
          <xsd:attribute name="name" type="xsd:string" use="required"/>
        <xsd:key name="BookKey">
          <xsd:selector xpath="."/>
          <xsd:field xpath="isbn"/>

The point to note here is, the selector XPath is having the expr. '.'

The XMLSchema Rec. http://www.w3.org/TR/xmlschema-1/ says:
{selector} specifies a restricted XPath ([XPath]) expression relative to instances of the 
element being declared. This must identify a node set of subordinate elements (i.e. contained 
within the declared element) to which the constraint applies.


3.11.4 The Identity-constraint Definition Validation Rules, 
http://www.w3.org/TR/xmlschema-1/#section-Identity-constraint-Definition-Validation-Rules says:
Validation Rule: Identity-constraint Satisfied 

For an element information item to be locally ·valid· with respect to an identity-constraint all 
of the following must be true:

1 The {selector}, with the element information item as the context node, evaluates to a node-set 
(as defined in [XPath]). [Definition:]  Call this the target node set. 

2 Each node in the ·target node set· is an element node among the descendants of the context 

3 ....

Looking at point 2 above, it reflects that, we cannot use '.' as the XPath expr. for a 
selector. Does *descendants of the context node* includes the context node?

On the other hand the production rule for the XPath expr. for the selector allows '.' as a 
valid XPath expr.

Please clarify.

Refer: http://lists.w3.org/Archives/Public/xmlschema-dev/2002Apr/0048.html


Sun Microsystems, Inc.
Received on Wednesday, 10 April 2002 05:21:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:58 UTC