Xml 为什么要使用<;xsd:sequence>;对于单个<;xsd:element>;?

Xml 为什么要使用<;xsd:sequence>;对于单个<;xsd:element>;?,xml,xsd,xsd-validation,xml-validation,Xml,Xsd,Xsd Validation,Xml Validation,因为XSD规范: 内容:(注释?, (简单内容|复杂内容 |((组|全部|选择|顺序)?, ((属性|属性组)*,anyAttribute?) 如果希望在内容模型中指定xsd:element,请将xsd:sequence视为所需的几个模型组之一。(除了xsd:sequence,您还可以使用另一个元素)设计可能不允许为一个元素的“组”指定任何模型组,但是就异常和不规则而言,xsd的扭曲、模糊的线必须在某处绘制。,你的意思是说,如果我们必须在复杂类型下使用元素,那么这只是我们需要遵循的规范,而不

因为XSD规范:


内容:(注释?,
(简单内容|复杂内容
|((组|全部|选择|顺序)?,
((属性|属性组)*,anyAttribute?)

如果希望在内容模型中指定
xsd:element
,请将
xsd:sequence
视为所需的几个模型组之一。(除了
xsd:sequence
,您还可以使用另一个元素)设计可能不允许为一个元素的“组”指定任何模型组,但是就异常和不规则而言,xsd的扭曲、模糊的线必须在某处绘制。

,你的意思是说,如果我们必须在复杂类型下使用元素,那么这只是我们需要遵循的规范,而不是“仅仅”规范。规范。W3CXMLSchema建议是定义XSD语法和语义的规范,因此是的,在本例中,如果希望使用或实现XSD,通常必须遵循它。如果您愿意,有许多XSD书籍可以作为适当的代理。
<xsd:complexType>
<xsd:sequence>
<xsd:element name="allowFieldTruncation" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType>
<xsd:element name="allowFieldTruncation" type="xsd:boolean"/>
</xsd:complexType>
<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>