为什么将 用于单个 ?

问题描述 投票:1回答:1
<xsd:complexType>
<xsd:sequence>
<xsd:element name="allowFieldTruncation" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>

在上面的示例中,我只有一个元素(称为allowFieldTruncation)在复杂类型下定义,并且对minOccursmaxOccurs]没有要求。现在我的问题是为什么我应该包含一个序列标签–定义不能像下面吗?

<xsd:complexType>
<xsd:element name="allowFieldTruncation" type="xsd:boolean"/>
</xsd:complexType>
[[[[]
xml xsd xsd-validation xml-validation
1个回答
1
投票
因为XSD规范says so

<complexType abstract = boolean : false block = (#all | List of (extension | restriction)) final = (#all | List of (extension | restriction)) id = ID mixed = boolean : false name = NCName {any attributes with non-schema namespace . . .}> Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))) </complexType>

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