Hi,
I want to use a unique ID attribute, which should be an integer value.
I tried the solution below with xpath, but the xml seems to be valid,
even if there are two equal ids. Any idea why?
My XSD
---------------------------------------------------------------------
<xs:element name="sample">
<xs:complexType >
<xs:choice maxOccurs="unbo unded">
<xs:element name="one" maxOccurs="10">
<xs:complexType >
<xs:attribute name="anothertx t" type="xs:string "/>
<xs:attribute name="sequencei d" type="xs:intege r" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="two" maxOccurs="10">
<xs:complexType >
<xs:attribute name="sequencei d" type="xs:intege r" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="three" maxOccurs="10">
<xs:complexType >
<xs:attribute name="sequencei d" type="xs:intege r" use="required"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="seqid">
<xs:selector xpath=".//sample"/>
<xs:field xpath="@sequenc eid"/>
</xs:key>
</xs:element>
---------------------------------------------------------------------
My XML
---------------------------------------------------------------------
<sample xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "sample.xsd ">
<one sequenceid="1"/>
<one sequenceid="2"/>
<two sequenceid="3"/>
<two sequenceid="3"/>
</sample>
---------------------------------------------------------------------
I want to use a unique ID attribute, which should be an integer value.
I tried the solution below with xpath, but the xml seems to be valid,
even if there are two equal ids. Any idea why?
My XSD
---------------------------------------------------------------------
<xs:element name="sample">
<xs:complexType >
<xs:choice maxOccurs="unbo unded">
<xs:element name="one" maxOccurs="10">
<xs:complexType >
<xs:attribute name="anothertx t" type="xs:string "/>
<xs:attribute name="sequencei d" type="xs:intege r" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="two" maxOccurs="10">
<xs:complexType >
<xs:attribute name="sequencei d" type="xs:intege r" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="three" maxOccurs="10">
<xs:complexType >
<xs:attribute name="sequencei d" type="xs:intege r" use="required"/>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="seqid">
<xs:selector xpath=".//sample"/>
<xs:field xpath="@sequenc eid"/>
</xs:key>
</xs:element>
---------------------------------------------------------------------
My XML
---------------------------------------------------------------------
<sample xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "sample.xsd ">
<one sequenceid="1"/>
<one sequenceid="2"/>
<two sequenceid="3"/>
<two sequenceid="3"/>
</sample>
---------------------------------------------------------------------
Comment