You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Evert Hoff <ev...@pixie.co.za> on 2002/11/15 13:51:25 UTC

Nillable KeyRef element

Hi,

I am trying to specify a KeyRef that may either refer to a value or be
empty. I have found different results with attributes and simple
content. I'm not sure what the intension of the spec is in this regard,
so I don't know if this behavior is a bug in Xerces or in accordance
with what the spec intended.

ATTRIBUTES

Please refer to the attached test.xsd. A person has an attribute
"manager-id" which refers to another person's "id" attribute. Use of
this attribute is specified as optional. In test.xml the first person
does not have this attribute. This behaves correctly and the parser does
not give an error.

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). 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.

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'.

Please let me know if I am misinterpreting the spec or whether this is a
bug.

Thanks in advance,

Evert