Unique Doesn't Work
Posted: Thu Jan 16, 2014 3:42 pm
Hi All,
I have the following XML file (I deleted from this example the reference to the XML schema to keep it clean):
This is my XML schema:
I would expect that the XML file wouldn't pass the validation because "10" appears twice as the value of <command_name>. But Oxygen keeps saying that the file is OK. If I intentionally try to do other invalid things (just to check that the schema is working at all), like entering string values into <command_name>, it does say that I entered an invalid value.
Am I doing anything wrong?
Thanks!
Alex
I have the following XML file (I deleted from this example the reference to the XML schema to keep it clean):
Code: Select all
<command_group>
<command>
<command_name>10</command_name>
<command_description>My command description</command_description>
</command>
<command>
<command_name>12</command_name>
<command_description>My another command description</command_description>
</command>
<command>
<command_name>10</command_name>
<command_description>ewewe</command_description>
</command>
</command_group>
This is my XML schema:
Code: Select all
<xs:element name="command_group">
<xs:complexType>
<xs:sequence>
<xs:element name="command" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="command_name" type="xs:integer" />
<xs:element name="command_description" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueCommand">
<xs:selector xpath="command" />
<xs:field xpath="command_name" />
</xs:unique>
</xs:element>
Am I doing anything wrong?
Thanks!
Alex