- From: <bugzilla@farnsworth.w3.org>
- Date: Fri, 25 Apr 2008 22:09:31 +0000
- To: www-xml-schema-comments@w3.org
- CC:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=5664 Summary: Should attribute xsi:type be an allowed field in an identity constraint Product: XML Schema Version: unspecified Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: Structures: XSD Part 1 AssignedTo: cmsmcq@w3.org ReportedBy: katrina.griffith@ge.com QAContact: www-xml-schema-comments@w3.org Would someone please clarify why the following unique constraint should not work? It seems to me that it should work and that this may be a bug. sample constraint: <xs:element name="ListNode" type="ListType" minOccurs="0"> <xs:unique name="Constraint1"> <xs:selector xpath="./Item"/> <xs:field xpath="@address"/> <xs:field xpath="@xsi:type"/> </xs:unique> </xs:element> In the sample xml that follows, I am expecting validation errors because more than one Item node of the same xsi:type share the same address value. sample xml: <RootNode xsi:noNamespaceSchemaLocation="TestSchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ListNode> <Item xsi:type="SpecificItemType1" address="1" file="file1.xml" name="Item1"/> <Item xsi:type="SpecificItemType1" address="1" file="file2.xml" name="Item2"/> <Item xsi:type="SpecificItemType2" address="1" file="file3.xml" name="Item3"/> </ListNode> </RootNode> Here is the full schema representation. sample xsd: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cs="TestSchema.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:simpleType name="AddressType1"> <xs:restriction base="xs:int"> <xs:minInclusive value="1"/> <xs:maxInclusive value="254"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="AddressType2"> <xs:restriction base="xs:int"> <xs:minInclusive value="0"/> <xs:maxInclusive value="655519"/> </xs:restriction> </xs:simpleType> <xs:complexType name="AListType"> <xs:sequence> <xs:element name="Item" type="AbstractItemType" minOccurs="0" maxOccurs="32"/> </xs:sequence> </xs:complexType> <xs:complexType name="AbstractItemType" abstract="true"> <xs:attribute name="name" type="xs:string" use="required"/> <xs:attribute name="file" type="xs:string" use="required"/> </xs:complexType> <xs:complexType name="SpecificItemType1"> <xs:complexContent> <xs:extension base="AbstractItemType"> <xs:attribute name="address" type="AddressType1" use="required"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="SpecificItemType2"> <xs:complexContent> <xs:extension base="AbstractItemType"> <xs:attribute name="address" type="AddressType2" use="required"/> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="RootNode"> <xs:complexType> <xs:sequence> <xs:element name="ListNode" type="AListType" minOccurs="0"> <xs:unique name="Constraint1"> <xs:selector xpath="./Item"/> <xs:field xpath="@address"/> <xs:field xpath="@xsi:type"/> </xs:unique> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Received on Friday, 25 April 2008 22:10:10 UTC