XSD ¸´ºÏÀàÐÍ - ½öº¬ÔªËØ

¡°½öº¬ÔªËØ¡±µÄ¸´ºÏÀàÐÍÔªËØÊÇÖ»Äܰüº¬ÆäËûÔªËØµÄÔªËØ¡£

¸´ºÏÀàÐͽö°üº¬ÔªËØ

XML ÔªËØ£¬"person"£¬½ö°üº¬ÆäËûµÄÔªËØ£º

<person>
<firstname>John</firstname>
<lastname>Smith</lastname>
</person>

Äú¿ÉÔÚ schema ÖÐÕâÑù¶¨Òå "person" ÔªËØ£º

<xs:element name="person">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="firstname" type="xs:string"/>
      <xs:element name="lastname" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

ÇëÁôÒâÕâ¸ö <xs:sequence>¡£ËüÒâζ×ű»¶¨ÒåµÄÔªËØ±ØÐë°´ÉÏÃæµÄ´ÎÐò³öÏÖÔÚ "person" ÔªËØÖС£

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

<xs:element name="person" type="persontype"/>

<xs:complexType name="persontype">
  <xs:sequence>
    <xs:element name="firstname" type="xs:string"/>
    <xs:element name="lastname" type="xs:string"/>
  </xs:sequence>
</xs:complexType>
VUE