XSD ¸´ºÏ¿ÕÔªËØ

¿ÕµÄ¸´ºÏÔªËØ²»Äܰüº¬ÄÚÈÝ£¬Ö»Äܺ¬ÓÐÊôÐÔ¡£

¸´ºÏ¿ÕÔªËØ£º

Ò»¸ö¿ÕµÄ XML ÔªËØ£º

<product prodid="1345" />

ÉÏÃæµÄ "product" ÔªËØ¸ù±¾Ã»ÓÐÄÚÈÝ¡£ÎªÁ˶¨ÒåÎÞÄÚÈݵÄÀàÐÍ£¬ÎÒÃǾͱØÐëÉùÃ÷Ò»¸öÔÚÆäÄÚÈÝÖÐÖ»Äܰüº¬ÔªËصÄÀàÐÍ£¬µ«ÊÇʵ¼ÊÉÏÎÒÃDz¢²»»áÉùÃ÷ÈκÎÔªËØ£¬±ÈÈçÕâÑù£º

<xs:element name="product">
  <xs:complexType>
    <xs:complexContent>
      <xs:restriction base="xs:integer">
        <xs:attribute name="prodid" type="xs:positiveInteger"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

ÔÚÉÏÃæµÄÀý×ÓÖУ¬ÎÒÃǶ¨ÒåÁËÒ»¸ö´øÓи´ºÏÄÚÈݵĸ´ºÏÀàÐÍ¡£complexContent ÔªËØ¸ø³öµÄÐźÅÊÇ£¬ÎÒÃÇ´òËãÏÞ¶¨»òÕßÍØÕ¹Ä³¸ö¸´ºÏÀàÐ͵ÄÄÚÈÝÄ£ÐÍ£¬¶ø integer ÏÞ¶¨ÔòÉùÃ÷ÁËÒ»¸öÊôÐÔµ«²»»áÒýÈëÈκεÄÔªËØÄÚÈÝ¡£

²»¹ý£¬Ò²¿ÉÒÔ¸ü¼Ó½ô´ÕµØÉùÃ÷´Ë "product" ÔªËØ£º

<xs:element name="product">
  <xs:complexType>
    <xs:attribute name="prodid" type="xs:positiveInteger"/>
  </xs:complexType>
</xs:element>

»òÕßÄú¿ÉÒÔΪһ¸ö complexType ÔªËØÆðÒ»¸öÃû×Ö£¬È»ºóΪ "product" ÔªËØÉèÖÃÒ»¸ö type ÊôÐÔ²¢ÒýÓÃÕâ¸ö complexType Ãû³Æ£¨Í¨¹ýʹÓô˷½·¨£¬Èô¸É¸öÔªËØ¾ù¿ÉÒýÓÃÏàͬµÄ¸´ºÏÀàÐÍ£©£º

<xs:element name="product" type="prodtype"/>

<xs:complexType name="prodtype">
  <xs:attribute name="prodid" type="xs:positiveInteger"/>
</xs:complexType>
VUE