The xsi:type attribute should be an allowed field in an identity constraint ---------------------------------------------------------------------------
Key: XERCESC-1797 URL: https://issues.apache.org/jira/browse/XERCESC-1797 Project: Xerces-C++ Issue Type: Bug Components: Validating Parser (XML Schema) Affects Versions: 2.7.0 Environment: Fedora 4 Linux (Embedded System) Reporter: Katrina Griffith Would someone please clarify why the following unique constraint does not work? It is an allowed construct in the W3C schema specification, so this may be a bug in the Parser. 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. I get no constraint error from the parser. 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> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]