我有xml可能是
<group>
<location/>
<persistent/>
</group>
或
<group>
<ui-location/>
<persistent/>
</group>
有没有办法为u-part设置通配符,或者是否有某种方式可以说出现在那里的元素可以是位置还是ui-location?
答案 0 :(得分:1)
回答你问题的第二部分。您可以使用xsd:choice
:
出现在那里的元素可以是location或ui-location
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:element name="location" type="xsd:string"/>
<xsd:element name="ui-location" type="xsd:string"/>
</xsd:choice>
</xsd:sequence>