Hi,

I am not quiet sure where to put the unique constraint. I have appended two
examples. The first one
works fine, the second one not. But I am not sure where is the difference?
I am just interested as the first does what I need. Can anybody explain?

Thanks Heike

-----------------------
works fine:
<xsd:element name="foo" type="FooType">
         <xsd:unique name="blubSelector">                   <-------------
unique here with xpath="bar"
           <xsd:selector xpath="bar"/>
           <xsd:field xpath="@id"/>
         </xsd:unique>
     </xsd:element>

<xsd:complexType name="FooType">
  <xsd:sequence>
    <xsd:element name="bar" type="BarType" maxOccurs="unbounded"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="BarType">
  <xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
------------------
does not work:
<xsd:element name="foo" type="FooType"/>

<xsd:complexType name="FooType">
  <xsd:sequence>
    <xsd:element name="bar" type="BarType" maxOccurs="unbounded"/>
       <xsd:unique name="blubSelector">
<------------------- unique here with xpath "."
           <xsd:selector xpath="."/>
           <xsd:field xpath="@id"/>
         </xsd:unique>
     </xsd:element>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="BarType">
  <xsd:attribute name="id" type="xsd:string"/>
</xsd:complexType>
------------
xml example
<foo>
  <bar id="1"/>
  <bar id="1"/>
</foo>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to