我有一个XSD模式用于验证XML文件。继承的复杂类型中元素的顺序
在XSD架构中,我创建了一个复合类型,其中包含一个属性组和一个选项,本身包含“_output”,一个反复出现的元素。
我的复杂类型:
<xs:complexType name="base_action">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="_output" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
<xs:attributeGroup ref="action"/>
</xs:complexType>
我也有其他元素(用自己的子元素)从复杂类型继承。
这种继承元素的为例:现在
<xs:element name="ex_elem" minOccurs="0">
<xs:complexType>
<xs:complexContent>
<xs:extension base="cockpit_base_action">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="to" minOccurs="0"/>
<xs:element name="from" minOccurs="0"/>
</xs:choice>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
,在XML中,这将工作:
<ex_elem>
<_output/>
<from>0</from>
<to>1</to>
</ex_elem>
但不是这样的:
<ex_elem>
<from>0</from>
<_output/>
<to>1</to>
</ex_elem>
还是这个:
<ex_elem>
<from>0</from>
<to>1</to>
<_output/>
</ex_elem>
从我的理解,复杂类型的选择不能与继承元素的选择混合。这对我来说是一个问题,因为有些情况下,我想将输出放在其他地方,而不是顶部。
我希望能够使用该元素而不必打扰序列。有没有办法做到这一点?