XSD: difference between Element and Attribute

后端 未结 4 1164
旧巷少年郎
旧巷少年郎 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:23

    
       
       Element value
    
    

    You can't have more than one attribute with the same name in XML, therefore you can't use minOccurs and maxOccurs for attributes.

    You don't need use="required" for elements because you can have minOccurs="1" instead.

    It is your choice when to use attributes and when to use elements. Here are some guidelines: http://www.ibm.com/developerworks/xml/library/x-eleatt.html

提交回复
热议问题