1
我需要創建具有特殊特徵的xsd和xml文件。例如'Plane'
與'Model' ... 'Ammo'
。如果我將'Ammo'
設置爲true
我需要設置Missiles
(0-10)的編號。如果'Ammo'
設置爲false
我應該無法選擇Missiles
的金額。我該如何製作這款切換臺? SXD文件的使用可選元素創建.xsd和.xml(if - then)
部分:
<xsd:complexType name="Plane">
<xsd:sequence>
<xsd:element name="Model" type="tns:Model" />
<xsd:element name="Ammunition" type="xsd:boolean" />
<!-- If ammo is true add Missiles -->
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Model">
<xsd:sequence>
<xsd:element name="ModelType" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="Missile">
<xsd:restriction base="xsd:byte">
<xsd:minExclusive value="0" />
<xsd:maxInclusive value="10" />
</xsd:restriction>
</xsd:simpleType>
而且xml
文件的一部分:
<Plane>
<Model>
<ModelType>MiG-29</ModelType>
</Model>
<Ammunition>true</Ammunition>
<!-- Set amount of missiles -->
</Plane>
這很簡單。謝謝! – rand0m86