I am writing an XML Schema for a database format for chess games. The moves are in a specific format which I validate with a regex; it looks something like this: <move>Pe2e4</move>
. The <move&>
element can also contain a <variation>' element. The problem is, I can't simply do
mixed="true"` because I need to validate the move. Here is the relevant part of the schema file:
<xs:element name="move">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="moveType">
<xs:attribute ref="time"/>
<xs:attribute ref="comment"/>
</xs:extension>
</xs:simpleContent>
<xs:sequence>
<xs:element ref="variation" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
moveType
is the type for moves that does the validation.
So can someone explain how I can:
- have my move regex validation,
- have my
<variation>
element, and - have my
time
andcomment
attributes.
BTW, the whole schema validates fine without the
<xs:sequence>
<xs:element ref="variation" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
part.