S
shyam
Hi All
As per my understanding we use xs:key when we want to have a unique
value for a element or attribute and keyref to refer to one of the
unique values of that element or attribute.
However I am not sure if this uniqueness is checked when we validate a
document using XMLSpy
Here is the protion of myschema
==================================================================
<xs:element name="PROTOHEADERENTRY">
<xs:complexType>
<xs:sequence>
<xs:element name="ABNFGRAMMER">
<xs:complexType>
<xs:sequence>
<xs:element name="ABNFRULESET">
<xs:simpleType>
<xs:list>
<xs:simpleType>
<xs:restriction base="xs:token">
<xsattern value="\p{IsBasicLatin}*"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="NAME" type="xs:token"/>
<xs:attribute name="HEADERSEQNUM" type="xsositiveInteger"/>
</xs:complexType>
</xs:element>
=================================================================
now at the root element , which is above PROTOHEADERENTRY, i do this
================================================================
<xs:key name="KEYHEADERNUM">
<xs:selector xpath="./PROTOHEADERENTRY"/>
<xs:field xpath="HEADERSEQNUM"/>
</xs:key>
Now when I write a xml file and validate against this schema it gets
validated even if I use same HEADERSEQNUM value for multiple
PROTOHEADERENTRY elements
I am using XMLSpy
I think I am missing some trick here
PLease Help
Regards
Shyam
As per my understanding we use xs:key when we want to have a unique
value for a element or attribute and keyref to refer to one of the
unique values of that element or attribute.
However I am not sure if this uniqueness is checked when we validate a
document using XMLSpy
Here is the protion of myschema
==================================================================
<xs:element name="PROTOHEADERENTRY">
<xs:complexType>
<xs:sequence>
<xs:element name="ABNFGRAMMER">
<xs:complexType>
<xs:sequence>
<xs:element name="ABNFRULESET">
<xs:simpleType>
<xs:list>
<xs:simpleType>
<xs:restriction base="xs:token">
<xsattern value="\p{IsBasicLatin}*"/>
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="NAME" type="xs:token"/>
<xs:attribute name="HEADERSEQNUM" type="xsositiveInteger"/>
</xs:complexType>
</xs:element>
=================================================================
now at the root element , which is above PROTOHEADERENTRY, i do this
================================================================
<xs:key name="KEYHEADERNUM">
<xs:selector xpath="./PROTOHEADERENTRY"/>
<xs:field xpath="HEADERSEQNUM"/>
</xs:key>
Now when I write a xml file and validate against this schema it gets
validated even if I use same HEADERSEQNUM value for multiple
PROTOHEADERENTRY elements
I am using XMLSpy
I think I am missing some trick here
PLease Help
Regards
Shyam