ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: Schema (XSD) :: XSD »ìºÏÄÚÈݵĸ´ºÏÀàÐÍ

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

Schema (XSD)
Schema (XSD) ½éÉ..
ΪºÎʹÓà XML Sch..
ÈçºÎ¶¨ÖÆ XSD
XSD - <schema..
XSD ¼òµ¥ÔªËØ
XSD ÊôÐÔ
XSD Ô¼ÊøÃæ
XSD ¸´ºÏÔªËØ
XSD ¸´ºÏ¿ÕÔªËØ
XSD ¸´ºÏ´¿ÔªËØ
XSD ¸´ºÏ´¿Îı¾
XSD »ìºÏÄÚÈݵĸ´..
XSD ָʾÆ÷¸´ºÏÀà..
XSD <any> ..
XSD <anyAttri..
XSD ÔªËØÌæ´ú
XSD ʵÀý
XSD ×Ö·û´®Êý¾ÝÀà..
XSD ÈÕÆÚÊý¾ÝÀàÐÍ
XSD СÊýÊý¾ÝÀàÐÍ

XSD »ìºÏÄÚÈݵĸ´ºÏÀàÐÍ


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-29 ÐÞ¸Ä:2007-08-28 ä¯ÀÀ:4661 :: ::

A mixed complex type element can contain attributes, elements, and text.
XSD»ìºÏÄÚÈݵĸ´ºÏÀàÐÍÔªËØ¿ÉÒÔ°üº¬ÊôÐÔ¡¢ÔªËغÍÎı¾¡£


Complex Types with Mixed Content
»ìºÏÄÚÈݵĸ´ºÏÀàÐÍ

An XML element, "letter", that contains both text and other elements:
Ò»¸öXMLÔªËØ£¬"letter"¼È¿ÉÒÔ°üº¬Îı¾ÓÖ¿ÉÒÔ°üº¬ÆäËüÔªËØ£º

<letter>
Dear Mr.<name>John Smith</name>.
Your order <orderid>1032</orderid>
will be shipped on <shipdate>2001-07-13</shipdate>.

</letter>

The following schema declares the "letter" element:
ÏÂÃæµÄXML SchemaÉùÃ÷ÁË"letter"ÔªËØ£º

<xs:element name="letter">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="name" type="xs:string"/>

<xs:element name="orderid" type="xs:positiveInteger"/>
<xs:element name="shipdate" type="xs:date"/>
</xs:sequence>

</xs:complexType>
</xs:element>

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">
<xs:sequence>
<xs:element name="name" type="xs:string"/>

<xs:element name="orderid" type="xs:positiveInteger"/>
<xs:element name="shipdate" type="xs:date"/>
</xs:sequence>

</xs:complexType>

ÆÀÂÛ (0) All