Arr*_*ran 4 xml xsd xml-validation xsd-validation
我一直无法找到任何有关此的信息,可能是由于我没有掌握术语。我想要做的是为货币创建一个模板元素(已经有),并在两个地方使用两个不同的名称(即currentBalance和maxBalance)使用它。
我当前的模板格式为:
<xsd:element name="currency">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:double">
<xsd:attribute ref="currencyCode" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
Run Code Online (Sandbox Code Playgroud)
只需全局定义和命名您要使用的复杂类型,
<xsd:complexType name="currency">
<xsd:simpleContent>
<xsd:extension base="xsd:double">
<xsd:attribute ref="currencyCode" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
Run Code Online (Sandbox Code Playgroud)
然后在需要的地方引用它:
<xsd:element name="currentBalance" type="currency"/>
<xsd:element name="maxBalance" type="currency"/>
Run Code Online (Sandbox Code Playgroud)