Subject:Error when data type not specified for key attributes Author:David Banbury Date:14 Feb 2008 07:29 PM
We have an XML Schema that uses keys and keyrefs at different levels in the element hierarchy. The keys and keyrefs are based on attributes of elements, the elements are generally empty.
Stylus Studio handles the keyrefs correctly as long as a "type" is specified for the key attributes in the XSD. If you take the same schema and remove the data type definitions from these attributes the built-in Stylus Studio parser returns the error:
"The key for identity constraint of element '...' is not found."
The attached example files are cut down to the bare minimum. The "GoodFile" example works, the "BadFile" example returns errors.
The Xalan, XSV & Saxonica parsers handle the BadFile examples perfectly well. (Microsoft parsers can't handle this keyref structure in either case!)
Subject:Error when data type not specified for key attributes Author:Alberto Massari Date:28 Feb 2008 08:53 AM
when you don't specify a type for an attribute, it is defined to be the special anySimpleType type. The specification warns that in this case "the mapping from lexical space to value space is unspecified for items whose type definition is the simple ur-type definition. Accordingly this specification does not constrain processors' behaviour in areas where this mapping is implicated, for example checking such items against enumerations, constructing default attributes or elements whose declared type definition is the simple ur-type definition, checking identity constraints involving such items".
So, having a key/keyref involving anySimpleType values will have a different behavior depending on which processor is being used.