XSD: difference between Element and Attribute

后端 未结 4 1169
旧巷少年郎
旧巷少年郎 2020-12-24 10:04

I\'m new to XSD, and I\'m quite confused as to when to use attribute, and when to use element?

Why cant we specify minOccurs and maxOccurs in attribute?

Also

4条回答
  •  误落风尘
    2020-12-24 10:24

    An element is an XML node - and it can contain other nodes, or attributes. It can be a simple type or a complex type. It is an XML entity.

    An attribute is a descriptor. It can't contain anything and can only be a simple type.

    Have a look at this. Of course, you can just google something like "XML element vs attribute"

提交回复
热议问题