Reputation: 11544
I am coding on a simple game and writing the *.xsd file.
My Problem is that the element should have as a content a number between 1 and 6, and the attribute should have a number between 1 and 4.
here is my code, but it does not function cause of the types:
<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>
The Problem is the numb_1_and_6-Type and the complex Type... So how to fix that?
greetings and thx in advance
Upvotes: 0
Views: 91
Reputation: 21658
You're missing the definition of the content, in your case simple since it extends a simple type:
<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>
Upvotes: 1