w3pop.com :: ÍøÂçѧԺ :: Schema (XSD) :: XSD »ìºÏÄÚÈݵĸ´ºÏÀàÐÍ
XSD »ìºÏÄÚÈݵĸ´ºÏÀàÐÍ
::
A mixed complex type element can contain attributes, elements, and text.
XSD»ìºÏÄÚÈݵĸ´ºÏÀàÐÍÔªËØ¿ÉÒÔ°üº¬ÊôÐÔ¡¢ÔªËغÍÎı¾¡£
An XML element, "letter", that contains both text and other elements:
Ò»¸öXMLÔªËØ£¬"letter"¼È¿ÉÒÔ°üº¬Îı¾ÓÖ¿ÉÒÔ°üº¬ÆäËüÔªËØ£º
<letter> |
The following schema declares the "letter" element:
ÏÂÃæµÄXML SchemaÉùÃ÷ÁË"letter"ÔªËØ£º
<xs:element name="letter"> |
Note: To enable character data to appear between the child-elements of "letter", the mixed attribute must be set to "true". The <xs:sequence> tag means that the elements defined (name, orderid and shipdate) must appear in that order inside a "letter" element.
×¢Ò⣺ΪÁËʹ×Ö·ûÊý¾ÝÄܳöÏÖÔÚ"letter"×ÓÔªËØÖ®¼ä£¬mixed ÊôÐÔ±ØÐëÉèÖÃΪ"true"¡£<xs:sequence>±êǩָ¶¨ÁËÒѶ¨ÒåµÄÔªËØ£¨name¡¢orderid ºÍ shipdate£©ÔÚ"letter"ÔªËØÖбØÐëÒÔÖ¸¶¨µÄ˳Ðò³öÏÖ¡£
We could also give the complexType element a name, and let the "letter" 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ÔªËØ¶¨ÒåÒ»¸öÃû³Æ£¬²¢ÇÒÈÃ"letter"ÔªËØ°üº¬Ò»¸öÒýÓÃÁËcomplexTypeÃû³ÆµÄÀàÐÍÊôÐÔ£¨Èç¹ûÄãʹÓÃÁËÉÏÊö·½·¨£¬¼¸¸öÔªËØ¿ÉÒÔͬʱÒýÓÃÏàͬµÄ¸´ºÏÀàÐÍ£©£º
<xs:element name="letter" type="lettertype"/> <xs:complexType name="lettertype" mixed="true"> |
ÆÀÂÛ (0)
All