XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
David BanburySubject: 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!)

Regards,
David Banbury


UnknownBadFile.xsd
XSD for the error case

UnknownBadFile.xml
XML for the error case

UnknownGoodFile.xsd
XSD for the good case

UnknownGoodFile.xml
XML for the good case

Posttop
(Deleted User) Subject: Error when data type not specified for key attributes
Author: (Deleted User)
Date: 28 Feb 2008 08:53 AM
Hi David,
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.

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.