XML Schema simpleContent ÔªËØ

¶¨ÒåºÍÓ÷¨

simpleContent ÔªËØ°üº¬¶Ô complexType ÔªËØ£¨ËüÒÔ×Ö·ûÊý¾Ý»ò simpleType ÔªËØÎªÄÚÈÝ£©µÄÀ©Õ¹»òÏÞÖÆ²¢ÇÒ²»°üº¬ÈκÎÔªËØ¡£

ÔªËØÐÅÏ¢

³öÏÖ´ÎÊý Ò»´Î
¸¸ÔªËØ complexType
ÄÚÈÝ

¿ÉÑ¡Ïî ¡ª annotation

±ØÑ¡Ïî ¡ª Óв¢ÇÒÖ»ÓÐÒ»¸öÏÂÁÐÔªËØ£º restriction (simpleContent) »ò extension (simpleContent)¡£

Óï·¨

<simpleContent
id=ID
any attributes
>

(annotation?,(restriction|extension))

</simpleContent>

£¨? ·ûºÅÉùÃ÷ÔÚ simpleContent ÔªËØÖиÃÔªËØ¿É³öÏÖÁã´Î»òÒ»´Î¡££©

ÊôÐÔ ÃèÊö
id ¿ÉÑ¡¡£¹æ¶¨¸ÃÔªËØµÄΨһµÄ ID¡£
any attributes ¿ÉÑ¡¡£¹æ¶¨´øÓÐ non-schema ÃüÃû¿Õ¼äµÄÈÎºÎÆäËûÊôÐÔ¡£

ʵÀý

Àý×Ó 1

ÕâÊÇÒ»¸ö½ö°üº¬Îı¾µÄ XML ÔªËØ (<shoesize>)£º

<shoesize country="france">35</shoesize>

ÏÂÃæµÄÀý×ÓÉùÃ÷ÁËÒ»¸ö¸´ÔÓÀàÐÍ "shoesize"£¬ÆäÄÚÈݱ»¶¨ÒåΪÕûÊýÊý¾ÝÀàÐÍ£¬²¢´øÓÐÒ»¸ö country ÊôÐÔ£º

<xs:element name="shoesize">
  <xs:complexType>
    <xs:simpleContent>
      <xs:extension base="xs:integer">
        <xs:attribute name="country" type="xs:string" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
</xs:element>
VUE