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

RE: key/keyref problem

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Mon, 2 Jul 2001 14:37:01 -0400
To: <vdv@dyomedea.com>, "'WATKIN-JONES,ADAM \(HP-UnitedKingdom,ex1\)'" <adam_watkin-jones@hp.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <003401c10326$2612c750$3182ce0a@xmls>

You are correct that it should be a QName.  I suspect it was a bug in a
previous version of XSV because the current on-line version of XSV does not
consider it an error.

To answer your question about why it is a QName, the key and keyref
definitions do _not_ have to be defined side by side in the same scoping
element.  The scoping element of the key can be a child of the scoping
element of the keyref.  That child may be in a different namespace.

In this example, mykey could have been defined in the declaration of keys,
and dummy1 could have been defined in the declaration of root.

Hope that helps!

Priscilla Walmsley
Vitria Technology

-----Original Message-----
From: xmlschema-dev-request@w3.org
[mailto:xmlschema-dev-request@w3.org]On Behalf Of Eric van der Vlist
Sent: Monday, July 02, 2001 1:43 PM
To: WATKIN-JONES,ADAM (HP-UnitedKingdom,ex1)
Cc: 'xmlschema-dev@w3.org'
Subject: Re: key/keyref problem

"WATKIN-JONES,ADAM (HP-UnitedKingdom,ex1)" wrote:
> Hello,
> My head is sore from bashing it against a brick wall so I hope someone can
> help me with this!

I think I can :=) at least to point a couple of issues...

> Below is some XML, a schema and the output from XSV when I try to
> I am trying to express a key/keyref constraint but I always get an XSV
> error.  I have tried altering the position of the xsd:keyref and xsd:key
> elements in case it is some sort of scoping problem but with no success.

Your scoping is good and I suspect a more trivial reason!


> <xsd:key name="mykey">
> <xsd:selector xpath="k1:keys/k1:key"/>
> <xsd:field xpath="@id"/>
> </xsd:key>
> <xsd:keyref name="dummy1" refer="k1:mykey">

If I change this to:

<xsd:keyref name="dummy1" refer="mykey">

XSV doesn't complain any longer.

Now, what's weird is that the rec mentions refer as a QName:

 id = ID
 name = NCName
 refer = QName
 {any attributes with non-schema namespace . . .}>
 Content: (annotation?, (selector, field+))

OTH, since key and keyrefs need to be defined side by side in the same
element, I wonder what is the reason for allowing a QName here since I
don't see how you could refer a key defined for another namespace.

The rec also says that the refer should be QName resolved and my bet
would be that you are right and that it's a SCV bug.

I am still confused, though ;) ...

Hope this helps.

See you at XTech in San Diego.
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
Received on Monday, 2 July 2001 14:37:59 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:52 UTC