0

私は単純なゲームをコーディングして、*.xsd ファイルを作成しています。

私の問題は、要素の内容として 1 から 6 までの数値が必要であり、属性には 1 から 4 までの数値が必要であるということです。

ここに私のコードがありますが、タイプの原因として機能しません:

        <xsd:element name="roll" type="numb_1_and_6">
            <xsd:complexType>
                <xsd:attribute name="player" use="required">
                    <xsd:simpleType>
                        <xsd:restriction base="xsd:integer">
                            <xsd:minInclusive value="1" />
                            <xsd:maxInclusive value="4" />
                        </xsd:restriction>
                    </xsd:simpleType>
                </xsd:attribute>
            </xsd:complexType>
        </xsd:element>

<xsd:simpleType name="numb_1_and_6">
    <xsd:restriction base="xsd:integer">
        <xsd:minInclusive value="1" />
        <xsd:maxInclusive value="6" />
    </xsd:restriction>
</xsd:simpleType>

問題はnumb_1_and_6-Typeとcomplex Typeです...それを修正するにはどうすればよいですか?

事前にご挨拶とthx

4

1 に答える 1

1

コンテンツの定義がありません。単純なタイプを拡張するため、あなたの場合は単純です。

<xsd:element name="roll"> 
    <xsd:complexType>
        <xsd:simpleContent>
            <xsd:extension base="numb_1_and_6">
                <xsd:attribute name="player" use="required"> 
                    <xsd:simpleType> 
                        <xsd:restriction base="xsd:integer"> 
                            <xsd:minInclusive value="1"/> 
                            <xsd:maxInclusive value="4"/> 
                        </xsd:restriction> 
                    </xsd:simpleType> 
                </xsd:attribute>                    
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType> 
</xsd:element> 
于 2012-04-07T16:36:08.223 に答える