I'm learning how to create xml/xsd documents and I'm stuck now. I don't know how to connect this restrictions in one component:
<xsd:simpleType name="unitType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="g"/>
<xsd:enumeration value="Gigabyte"/>
<xsd:enumeration value="mAh"/>
<xsd:enumeration value="Year"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ProducedContent">
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="1970"/>
<xsd:maxInclusive value="2015"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="ProducedContent">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="unit" type="unitType" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
I know that it will not work, but I must set above restrictions to this element:
<Produced unit="Year">2014</Produced>
The restrictions you request on this XML instance:
Will be enforced by this XSD: