w3pop.com :: ÍøÂçѧԺ :: Schema (XSD) :: XSD ¸´ºÏ´¿ÔªËØ
An "elements-only" complex type contains an element that contains only other elements.
“ ´¿ÔªËØ£¨Elements-only£©” µÄ¸´ºÏÀàÐͰüº¬ÁËÒ»¸öÖ»°üº¬ÆäËüÔªËØµÄÔªËØ¡£
An XML element, "person", that contains only other elements:
Ò»¸öXMLÔªËØ"person"Ö»º¬ÓÐÆäËüÔªËØ£º
<person> |
You can define the "person" element in a schema, like this:
Äã¿ÉÒÔÔÚһƪschemaÀﶨÒå"person"ÔªËØ£¬ÈçÏÂËùʾ£º
<xs:element name="person"> |
Notice the <xs:sequence> tag. It means that the elements defined ("firstname" and "lastname") must appear in that order inside a "person" element.
Çë×¢Òâ<xs:sequence>±êÇ©¡£Õâ±íʾËù¶¨ÒåµÄÔªËØ("firstname" ºÍ "lastname")±ØÐëÔÚ"person"ÔªËØÀïÒÔ<xs:sequence>±êÇ©¶¨ÒåµÄ´ÎÐò³öÏÖ¡£
Or you can give the complexType element a name, and let the "person" element have a type attribute that refers to the name of the complexType (if you use this method, several elements can refer to the same complex type):
»òÕߣ¬Äã¿ÉÒÔΪcomplexTypeÔªËØ¶¨ÒåÒ»¸öÃû³Æ£¬ÈÃ"person"ÔªËØ°üº¬Ò»¸öÀàÐÍÊôÐÔ£¬¸ÃÀàÐÍÊôÐÔµÄÃû³Æ¿ÉÒÔÒýÓÃcomplexTypeÔªËØµÄÃû³Æ£¨Èç¹ûÄãÓÃÉÏÊö·½·¨£¬¼¸¸öÔªËØ¿ÉÒÔͬʱÒýÓÃÏàͬµÄ¸´ºÏÀàÐÍ£©£º
<xs:element name="person" type="persontype"/> <xs:complexType name="persontype"> |
ÆÀÂÛ (0)
All