- From: by way of <evert.hoff@pixie.co.za>
- Date: Tue, 03 Dec 2002 08:57:47 -0700
- To: W3C XML Schema Comments list <www-xml-schema-comments@w3.org>
- Message-Id: <5.1.0.14.1.20021203085743.02a062b8@localhost>
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 have validated this with Xerces, XmlSpy and the GotDotNet XSD Schema Validator and get the same results with all. 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. 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'. Please let me know if there is another way of making an element either refer to something or be empty. 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. Thanks in advance, Evert
Attachments
Received on Tuesday, 3 December 2002 13:15:44 UTC