在 XML 中定义唯一的序列

问题描述 投票:0回答:0

给定 XML

<properties>
    <prop1>3.9.0</prop1>
    <prop2>1.2.0</prop2>
    <prop2>1.2.1</prop2>
    <prop3>6.6.0</prop3>
</properties>
<xs:element minOccurs="0" name="properties">
    <xs:complexType>
        <xs:sequence>
            <xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

我想防止 prop2 标签重复,而不以其他方式限制它。那么如何确保这些属性的唯一性而不需要定义它们呢?

或者换句话说,如何定义充当集合的 XML 序列?

xml xsd
© www.soinside.com 2019 - 2024. All rights reserved.