<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>5664</bug_id>
          
          <creation_ts>2008-04-25 22:09:30 +0000</creation_ts>
          <short_desc>Should attribute xsi:type be an allowed field in an identity constraint</short_desc>
          <delta_ts>2008-05-09 16:17:44 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XML Schema</product>
          <component>Structures: XSD Part 1</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Katrina Griffith">katrina.griffith</reporter>
          <assigned_to name="C. M. Sperberg-McQueen">cmsmcq</assigned_to>
          
          
          <qa_contact name="XML Schema comments list">www-xml-schema-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>19946</commentid>
    <comment_count>0</comment_count>
    <who name="Katrina Griffith">katrina.griffith</who>
    <bug_when>2008-04-25 22:09:30 +0000</bug_when>
    <thetext>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:

&lt;xs:element name=&quot;ListNode&quot; type=&quot;ListType&quot; minOccurs=&quot;0&quot;&gt;
  &lt;xs:unique name=&quot;Constraint1&quot;&gt;
    &lt;xs:selector xpath=&quot;./Item&quot;/&gt;
    &lt;xs:field xpath=&quot;@address&quot;/&gt;
    &lt;xs:field xpath=&quot;@xsi:type&quot;/&gt;                    
  &lt;/xs:unique&gt;
&lt;/xs:element&gt;

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:

&lt;RootNode xsi:noNamespaceSchemaLocation=&quot;TestSchema.xsd&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
	&lt;ListNode&gt;
		&lt;Item xsi:type=&quot;SpecificItemType1&quot; address=&quot;1&quot; file=&quot;file1.xml&quot; name=&quot;Item1&quot;/&gt;
		&lt;Item xsi:type=&quot;SpecificItemType1&quot; address=&quot;1&quot; file=&quot;file2.xml&quot; name=&quot;Item2&quot;/&gt;
		&lt;Item xsi:type=&quot;SpecificItemType2&quot; address=&quot;1&quot; file=&quot;file3.xml&quot; name=&quot;Item3&quot;/&gt;
	&lt;/ListNode&gt;
&lt;/RootNode&gt;

Here is the full schema representation.

sample xsd:

&lt;xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:cs=&quot;TestSchema.xsd&quot; elementFormDefault=&quot;qualified&quot; attributeFormDefault=&quot;unqualified&quot;&gt;
   &lt;xs:simpleType name=&quot;AddressType1&quot;&gt;
     &lt;xs:restriction base=&quot;xs:int&quot;&gt;
	&lt;xs:minInclusive value=&quot;1&quot;/&gt;
	&lt;xs:maxInclusive value=&quot;254&quot;/&gt;
     &lt;/xs:restriction&gt;
   &lt;/xs:simpleType&gt;
   &lt;xs:simpleType name=&quot;AddressType2&quot;&gt;
     &lt;xs:restriction base=&quot;xs:int&quot;&gt;
	&lt;xs:minInclusive value=&quot;0&quot;/&gt;
	&lt;xs:maxInclusive value=&quot;655519&quot;/&gt;
     &lt;/xs:restriction&gt;
   &lt;/xs:simpleType&gt;
   &lt;xs:complexType name=&quot;AListType&quot;&gt;
     &lt;xs:sequence&gt;
	&lt;xs:element name=&quot;Item&quot; type=&quot;AbstractItemType&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;32&quot;/&gt;
     &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name=&quot;AbstractItemType&quot; abstract=&quot;true&quot;&gt;		
      &lt;xs:attribute name=&quot;name&quot; type=&quot;xs:string&quot; use=&quot;required&quot;/&gt;
      &lt;xs:attribute name=&quot;file&quot; type=&quot;xs:string&quot; use=&quot;required&quot;/&gt;		
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name=&quot;SpecificItemType1&quot;&gt;		
      &lt;xs:complexContent&gt;
	&lt;xs:extension base=&quot;AbstractItemType&quot;&gt;
	   &lt;xs:attribute name=&quot;address&quot; type=&quot;AddressType1&quot; use=&quot;required&quot;/&gt;
	&lt;/xs:extension&gt;
      &lt;/xs:complexContent&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name=&quot;SpecificItemType2&quot;&gt;		
     &lt;xs:complexContent&gt;
	&lt;xs:extension base=&quot;AbstractItemType&quot;&gt;
	   &lt;xs:attribute name=&quot;address&quot; type=&quot;AddressType2&quot; use=&quot;required&quot;/&gt;
	&lt;/xs:extension&gt;
     &lt;/xs:complexContent&gt;
   &lt;/xs:complexType&gt;
  &lt;xs:element name=&quot;RootNode&quot;&gt;
    &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
            &lt;xs:element name=&quot;ListNode&quot; type=&quot;AListType&quot; minOccurs=&quot;0&quot;&gt;
                &lt;xs:unique name=&quot;Constraint1&quot;&gt;
                    &lt;xs:selector xpath=&quot;./Item&quot;/&gt;
                    &lt;xs:field xpath=&quot;@address&quot;/&gt;  
                    &lt;xs:field xpath=&quot;@xsi:type&quot;/&gt;
                &lt;/xs:unique&gt;
             &lt;/xs:element&gt;
         &lt;/xs:sequence&gt;
       &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
&lt;/xs:schema&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19947</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2008-04-25 22:29:32 +0000</bug_when>
    <thetext>Are you suggesting there is a bug in the W3C spec, or in some vendor&apos;s implementation of the spec?

I can&apos;t see anything in the spec that says xsi:type is not allowed in a constraint, therefore it is allowed, therefore you should raise a bug against any implementation that doesn&apos;t allow it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20064</commentid>
    <comment_count>2</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2008-05-09 16:12:09 +0000</bug_when>
    <thetext>On the XML Schema WG call today, we discussed this issue.  We believe
the analysis given in comment #1 is correct, and that if a processor
rejects an identity constraint on the grounds that it involves xsi:type, 
then there is probably a bug in the processor.

We therefore are closing the issue as WORKSFORME.

This change to the record should cause email to be sent to the originator
of the issue.  Thank you for the comment; we hope that the clarification
in comment #1 addresses your question.

If you are happy with this resolution of the issue, please indicate so
by changing the status of the issue to CLOSED.  If you are unhappy with
it, and want the WG to reconsider, you can so indicate by changing the
status to REOPENED.

If we don&apos;t hear from you in a reasonable amount of time (say two weeks),
we&apos;ll assume you are content.  

Thank you again for your comment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20065</commentid>
    <comment_count>3</comment_count>
    <who name="Katrina Griffith">katrina.griffith</who>
    <bug_when>2008-05-09 16:17:44 +0000</bug_when>
    <thetext>Thank you for answering my question.  I needed to know that this was a valid construct before persuing the issue with my implementation provider.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>