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

Re: Nillable KeyRef element

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 04 Dec 2002 10:19:38 +0000
To: Evert Hoff <evert.hoff@pixie.co.za> (by way of "C. M. Sperberg-McQueen" <cmsmcq@acm.org>)
Cc: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>
Message-ID: <f5bhedu5bnp.fsf@erasmus.inf.ed.ac.uk>

Evert Hoff <evert.hoff@pixie.co.za> (by way of "C. M. Sperberg-McQueen" <cmsmcq@acm.org>) writes:

> SIMPLE CONTENT
> 
> This same xsd specifies that the root element may contain "person"
> elements as well as "dog" elements. A person can have a child element
> called "dog-name" which refers to a "dog" element. Nillable has been set
> to true so that "dog-name" can be empty (nil).

Give its type of xs:string, you don't need nillable to allow
<dog-name> to be empty, it can already.

> I specifically don't want to remove the "dog-name" element, but just
> create an empty "dog-name", as with the second person in test.xml.
> Because if the whole element is removed, then there is no place to put
> attributes.
> 
> I get the following parser error, which means that it doesn't allow the
> nil value for "dog-name" even though dog-name has been set to nillable:
>
> Line 13: Parser error: Key 'person.dog-name' with value 'ID Value:  '
> not found for identity constraint of element 'personnel'.

This error message is hard to read, but the substance is correct --
you have a persone with a dog-name daughter, so the value of that
(since your keyref field is '.'), which is the empty string, is used
to look for a matching key, but there is none.

> Please let me know if there is another way of making an element either
> refer to something or be empty.

I don't think so.

> If there isn't another way, then maybe the spec needs to change so that
> if an element is nillable, then the KeyRef doesn't have to refer to a
> valid key. Then it will work similar to how attributes work.

That's a reasonable suggestion, provided you actually said

  <dog-name xsi:nil='true'/>

in your instance.

For consideration for 1.1, I think

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Wednesday, 4 December 2002 05:19:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:01 GMT