0

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 domixed="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:

  1. have my move regex validation,
  2. have my <variation> element, and
  3. have my time and comment attributes.

BTW, the whole schema validates fine without the

<xs:sequence>
    <xs:element ref="variation" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>

part.

4

1 回答 1

0

多亏了 Alejandro 和 Nic Gibson 的建议,我最终重新组织了架构。<variation> 元素现在位于 <move> 元素之外。

于 2010-11-24T17:46:52.320 回答