こんにちは、私はこの問題を約 1 時間調べていましたが、それが何を意味するのかさえわかりませんでした。
これが私の XML スキーマ コードです。
<xsd:element name="game">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="info" minOccurs="0" maxOccurs="1" type="infoType">
</xsd:element>
<xsd:element name="moves" type="movesType" minOccurs="1">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="infoType">
<xsd:sequence>
<xsd:element name="name" minOccurs="0" maxOccurs="1" type="xsd:string"></xsd:element>
<xsd:element name="description" minOccurs="0" maxOccurs="1" type="descriptionType">
</xsd:element>
<xsd:element name="started" type="xsd:dateTime"></xsd:element>
<xsd:element name="players" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="screenname" minOccurs="0" maxOccurs="4" type="xsd:string">
<xsd:complexType>
<xsd:attribute name="player" use="required"> </xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="number" type="xsd:integer" use="required"></xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="rounds" minOccurs="0" maxOccurs="1" type="xsd:integer"></xsd:element>
<xsd:element name="winner" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:attribute name="player" type="playerType" use="required"></xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="movesType">
<xsd:choice maxOccurs="unbounded">
<xsd:element name="roll" >
<xsd:complexType>
<xsd:simpleContent>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1"></xsd:minInclusive>
<xsd:maxInclusive value="6"></xsd:maxInclusive>
</xsd:restriction>
</xsd:simpleContent>
<xsd:attribute name="player" type="playerType"></xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="piece">
<xsd:complexType>
<xsd:attribute name="player" type="playerType" use="required"></xsd:attribute>
<xsd:attribute name="nr" type="xsd:integer" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1"></xsd:minInclusive>
<xsd:maxInclusive value="16"></xsd:maxInclusive>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="field" type="xsd:integer" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1"></xsd:minInclusive>
<xsd:maxInclusive value="72"></xsd:maxInclusive>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
<xsd:simpleType name="playerType" >
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1"></xsd:minInclusive>
<xsd:maxInclusive value="4"></xsd:maxInclusive>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="descriptionType" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="i" type="descriptionType" ></xsd:element>
<xsd:element name="b" type="descriptionType"></xsd:element>
</xsd:choice>
</xsd:complexType>
そして、これが私が得たパーサーエラーです。
game.xsd:25:
element complexType:
Schemas parser error :
Element '{http://www.w3.org/2001/XMLSchema}element':
The attribute 'type' and the child are mutually exclusive.
game.xsd:51:
element attribute:
Schemas parser error :
Element '{http://www.w3.org/2001/XMLSchema}complexType':
The content is not valid. Expected is (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))).
game.xsd:58:
element simpleType:
Schemas parser error :
Element '{http://www.w3.org/2001/XMLSchema}attribute':
The attribute 'type' and the child are mutually exclusive.
game.xsd:66:
element simpleType:
Schemas parser error :
Element '{http://www.w3.org/2001/XMLSchema}attribute':
The attribute 'type' and the child are mutually exclusive. WXS schema game.xsd failed to compile
これは大学のプロジェクト用で、6 時間以内に提出する必要があります。この時間内に解決策を見つけられることを願っています。
ありがとう