Hallo,
I have the following table and schema (which I have aded line numbers to). Hopefully they should work:
I have enforced the row number to be unique within the table, and I could do similar with the column.
The types intRow and intCol are 1 to 30 and 1 to 8 respectively.
My problem is that I need to ensure that each designation is unique in the whole table?
The way I imagine is something like:
I have the following table and schema (which I have aded line numbers to). Hopefully they should work:
Code:
<table>
<row number="1">
<col number="1" designation="Hamster"/>
</row>
<row number="2">
<col number="1" designation="Budgie"/>
<col number="2" designation="Parrot"/>
<col number="3" designation="Dog"/>
</row>
</table>
01<xs:element name="table">
02 <xs:complexType>
03 <xs:sequence>
04 <xs:element name="row" minOccurs="0" maxOccurs="30">
05 <xs:complexType>
06 <xs:sequence>
07 <xs:element name="col" minOccurs="0" maxOccurs="8">
08 <xs:complexType>
09 <xs:attribute name="number" type="intCol"/>
10 <xs:attribute name="designation" type="strDesignation"/>
11 </xs:complexType>
12 </xs:element>
13 </xs:sequence>
14 <xs:attribute name="number" type="intRow"/>
15 </xs:complexType>
16 </xs:element>
17 </xs:sequence>
18 </xs:complexType>
19 <xs:unique name="tablerownumber">
20 <xs:selector xpath="row"/>
21 <xs:field xpath="@number"/>
22 </xs:unique>
23</xs:element>
I have enforced the row number to be unique within the table, and I could do similar with the column.
The types intRow and intCol are 1 to 30 and 1 to 8 respectively.
My problem is that I need to ensure that each designation is unique in the whole table?
The way I imagine is something like:
Code:
<xs:unique name="channelnetnumber">
<xs:selector xpath="table"/>
<xs:field xpath="@designation"/>
</xs:unique>
[code]
inserted after line 22, but this does not seem to work.
Any clues? I admit that I am new to this so it's probably that I don't understand the concept.
Also, I am using the home version of XMLSpy and it does not report any validation errors when validating my schema, whereas I thought it would if I am referring to attributes which don't exist.
It does sometimes report:
'The xpath attribute value '../@designation' is not a valid restricted XPath expression.'
What's a restricted XPath expression?
Any help much appreciated,
- Frink