Note that there are some explanatory texts on larger screens.

plurals
  1. POHow make univoque my enumeration by xs:unique
    primarykey
    data
    text
    <p>Can anyone point me as to why the unique element in my XSD is not forcing unique-ness? This should throw an error because the last <code>ScreenResult</code> element does not contain a unique value for the <code>Type</code> attribute. I should also note that I'm truly after forcing one of each <code>Type</code> within <code>ScreenResults</code> (<code>ScreenResult</code> is required to exist 3 times, there are 3 types of screens and I am requiring unique-ness) so if there is a better way to accomplish that, I'm all for that as well. </p> <p>Thank you.</p> <p>Here is my XML snippet:</p> <pre><code>&lt;ScreenResults&gt; &lt;ScreenResult Type="Screen Type A"&gt;1&lt;/ScreenResult&gt; &lt;ScreenResult Type="Screen Type B"&gt;1&lt;/ScreenResult&gt; &lt;ScreenResult Type="Screen Type B"&gt;2&lt;/ScreenResult&gt; &lt;/ScreenResults&gt; </code></pre> <p>Here is my XSD snippet (also note that my original XSD snippets span multiple files but I have verified all of my namespaces are correct):</p> <pre><code>&lt;xs:element name="ScreenResults" type="import:ScreenResults" minOccurs="0" maxOccurs="1"&gt; &lt;xs:unique name="UniqueScreenResults"&gt; &lt;xs:selector xpath="ScreenResult" /&gt; &lt;xs:field xpath="@Type" /&gt; &lt;/xs:unique&gt; &lt;/xs:element&gt; &lt;!--============ ScreenResults =============--&gt; &lt;xs:complexType name="ScreenResults"&gt; &lt;xs:sequence minOccurs="1" maxOccurs="1"&gt; &lt;xs:element name="ScreenResult" minOccurs="3" maxOccurs="3"&gt; &lt;xs:complexType&gt; &lt;xs:simpleContent&gt; &lt;xs:extension base="enum:ScreenResult"&gt; &lt;xs:attribute name="Type" type="enum:ScreenType" use="required" /&gt; &lt;/xs:extension&gt; &lt;/xs:simpleContent&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;!--============= ScreenType =============--&gt; &lt;xs:simpleType name="ScreenType"&gt; &lt;xs:restriction base='xs:token'&gt; &lt;xs:enumeration value='Screen Type A' &gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;1&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:enumeration&gt; &lt;xs:enumeration value='Screen Type B' &gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;2&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:enumeration&gt; &lt;xs:enumeration value='Screen Type C' &gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;3&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:enumeration&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;!--============ ScreenResult ============--&gt; &lt;xs:simpleType name="ScreenResult"&gt; &lt;xs:restriction base='xs:token'&gt; &lt;xs:enumeration value='1' &gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;Positive&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:enumeration&gt; &lt;xs:enumeration value='2' &gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;Negative&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:enumeration&gt; &lt;xs:enumeration value='3' &gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;Not administered&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:enumeration&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload