XSD 中的简单类型联合?

Union of simple types in XSD?

我必须制作一个简单的元素,它可以是整数或日期。我必须使用的元素是 score.

我看了几个链接,但我不太明白。

例如:how to define xsd element with multiple option?

https://www.w3schools.com/xml/schema_simple.asp

使用 xsd:union 创建新类型,由其他 xs:integerunionxs:date:

组成
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="score">
    <xs:simpleType>
      <xs:union memberTypes="xs:integer xs:date"/>
    </xs:simpleType>
  </xs:element>
</xs:schema>