W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2001

Re: keyRef scope and Xerces Parser !?

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Tue, 26 Jun 2001 23:00:33 +0200
Message-ID: <3B38F7F1.B32D3A88@dyomedea.com>
To: Uwe Zeise <uwezeise@yahoo.de>
Cc: xmlschema-dev@w3.org
> Uwe Zeise wrote:
> 
.../...
> 
> <element name="root">
>  <complexType>
>   <sequence>
>    <element ref="a:probabilites"/>
>    <element ref="a:values"/>
>   </sequence>
>  </complexType>
> </element>
> 
> <element name="probabilities">
>  <complexType>
>   <sequence>
>    <element ref="a:probability" maxOccurs="10"/>
>   </sequence>
>  </complexType>
>  <key name="probKey">
>   <selector xpath="./a:probability"/>
>   <field xpath="@probID"/>
>  </key>
> </element>
> 
> <element name="values">
>  <complexType>
>   <sequence>
>    <element ref="a:value" maxOccurs="10"/>
>   </sequence>
>  </complexType>
>  <keyref name="probRef" refer="a:probKey">
>   <selector xpath="./a:value"/>
>   <field xpath="@probRef"/>
>  </key>
> </element>
> 
> ...and so on
> 
> In my opinion this XML-Schema fulfills the specs but the Xerces-Parser
> is complaining about the reference:
> 
> Error:  org.xml.sax.SAXParseException: Identity Constraint error:
> identity cons
> traint "KeyRef@19f91c" has a keyref which refers to a key or unique
> that is out
> of scope.
> What does this error exactly mean ?

It means that a xs:unique or xs:key and its corresponding xs:keyref need
to be defined in the same element (the tables storing the values are
local to this element).

In your example, you have no other choice than defining both at the
level of the root element.

Hope this helps.

Eric

> Thanks in advance and best regards,
> 
> Uwe
> 
> 

-- 
Pour y voir plus clair dans la nebuleuse XML...
                                          http://dyomedea.com/formation/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Tuesday, 26 June 2001 17:00:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:21 GMT