Xsd xml schema maxOccurs=xs:all中的无界
是否可以组合使用Xsd xml schema maxOccurs=xs:all中的无界,xsd,Xsd,是否可以组合使用xs:all和xs:sequence 我有一个xml结构,其中有一个元素probenode,它由元素名称、id、url、标记、优先级、statews_raw和active组成。以及设备和组的组合 设备和组可以出现零次或多次 下面的解决方案不起作用,因为它不允许对元素使用无界。在所有组中 <xs:complexType name="probenodetype"> <xs:all> <xs:element name="name"
xs:all
和xs:sequence
我有一个xml结构,其中有一个元素probenode,它由元素名称、id、url、标记、优先级、statews_raw和active组成。以及设备和组的组合
设备和组可以出现零次或多次
下面的解决方案不起作用,因为它不允许对元素使用无界。在所有组中
<xs:complexType name="probenodetype">
<xs:all>
<xs:element name="name" type="xs:string" />
<xs:element name="id" type="xs:unsignedInt" />
<xs:element name="url" type="xs:string" />
<xs:element name="tags" />
<xs:element name="priority" type="xs:unsignedInt" />
<xs:element name="status_raw" type="xs:unsignedInt" />
<xs:element name="active" type="xs:boolean" />
<xs:element name="device" type="devicetype" minOccurs="0" maxOccurs="unbounded">
<!-- zie devicetype -->
</xs:element>
<xs:element name="group" type="grouptype" minOccurs="0" maxOccurs="unbounded">
<!-- zie grouptype -->
</xs:element>
</xs:all>
<xs:attribute name="noaccess" type="xs:integer" use="optional" />
</xs:complexType>
在XSD 1.0中,xs:all的子项必须将maxOccurs设置为1 在XSD1.1中,此约束被解除 因此,您的备选方案似乎是:
- 使用XSD1.1处理器(Saxon或Xerces-J)
- 使用XSD 1.0并对probenodetype的子级施加命令。如果子项出现的顺序包含信息(因此id后跟url不同于url后跟id…),则这是一个问题