使用xml模式强制执行isA关系

使用xml模式强制执行isA关系,xml,xsd,Xml,Xsd,有没有办法在xmlSchema中强制执行标准isA关系 大概是 <complextype name="item"> #can be one of <element type="desktop computer"/> <element type="laptop"/> <element type="smartphone"/> </complextype> 等等 我知道这听起来像是一个

有没有办法在xmlSchema中强制执行标准isA关系

大概是

<complextype name="item">    
  #can be one of    
  <element type="desktop computer"/>    
  <element type="laptop"/>    
  <element type="smartphone"/>    
</complextype>
等等

我知道这听起来像是一个相当做作的例子,你可能会说我需要为每个项目定义一个新类型。。。但我们假设这是一组非常有限的类型


或者您可以从关于提要()的isA关系的另一个问题中取一个例子,您可以这样使用xs:choice:-

<complexType name="item">
    <choice>
        <element name="dc" type="desktop_computer"/>
        <element name="lp" type="laptop" />
    </choice>
</complexType>


最后,我希望能够定义一个项目列表,它是一组非空的项目…谢谢Porges。我试过,但不知道如何做代码片段的事情。。。
<complexType name="item">
    <choice>
        <element name="dc" type="desktop_computer"/>
        <element name="lp" type="laptop" />
    </choice>
</complexType>